'설정'에 해당되는 글 3건

  1. 2009.04.28 chkconfig 사용
  2. 2009.04.07 리눅스 시스템 시간 설정 하기
  3. 2008.08.29 ssh 관련 설정 파일
2009. 4. 28. 20:50

시스템이 시작할 때 불필요하거나 사용하지 않는 서비스를 실행하지 않게 하는 방법 중 최근에 많이 쓰이는 명령어로 chkconfig가 있다. chkconfig 명령어를 이용하면 시스템에 설치되어 있는 모든 서비스 데몬을 확인할 수 있고, 특정 서비스를 쉽게 활성화하거나 해제할 수 있다.

예를 들어보자.


#chkconfig --list

//시스템에 설치되어 있는 모든 서비스 데몬을 확인할 수 있다.

#chkconfig --level 2345 sendmail off

//런레벨 2~5에서 sendmail을 해제한다.

#chkconfig --level 2345 nfs on

//런레벨 2~5에서 nfs 서비스를 활성화한다.

#chkconfig rlogin off

//xinetd 기반의 서비스인 rlogin을 해제한다.


--add와 --del 스위치를 사용해서 서비스를 추가하거나 삭제할 수 있다. chkconfig는 단지 설정 파일을 변경하여, 시스템을 부팅했을 때 해당 서비스 데몬의 실행 여부만 결정하는 것이므로, 다앙 서비스를 시작시키거나 중지시키려면 반드시 service 명령을 사용해야 한다. 참고로 service 명령어는 다음과 같이 사용한다.


service 서비스명 {start | stop | restart | reload}


레드햇에는 chkconfig외에도 ntsysv라는 조금은 오래된 툴이 있다. 이 툴은 시스템을 재시작할 때 자동으로 시작할 데몬을 *로 체크해서 손쉽게 지정할 수 있다. 

ManPage

NAME

  chkconfig - updates and queries runlevel information for system services


SYNOPSIS

  chkconfig --list [name]

  chkconfig --add name

  chkconfig --del name

  chkconfig [--level levels] name <on|off|reset>

  chkconfig [--level levels] name


DESCRIPTION

  chkconfig  provides  a  simple  command-line  tool  for maintaining the /etc/rc[0-6].d directory hierarchy by relieving system administrators of the task of directly manipu-lating the numerous symbolic links in those directories.

  This  implementation of chkconfig was inspired by the chkconfig command present in the IRIX operating system. Rather than maintaining configuration  information  outside  of the  /etc/rc[0-6].d  hierarchy, however, this version directly manages the symlinks in /etc/rc[0-6].d. This leaves all of the configuration information regarding  what  ser-vices init starts in a single location.

  chkconfig  has  five  distinct functions: adding new services for management, removing services from management, listing the current startup information for services, chang- ing the startup information for services, and checking the startup state of a particu- lar service.

  When chkconfig is run without any options, it displays usage information.  If  only  a service  name is given, it checks to see if the service is configured to be started in the current runlevel. If it is, chkconfig returns true; otherwise  it  returns  false.

  The  --level option may be used to have chkconfig query an alternative runlevel rather than the current one.

  If one of on, off, or reset is specified after the service name, chkconfig changes the startup information for the specified service.  The on and off flags cause the service to be started or stopped, respectively, in the runlevels  being  changed.   The  reset flag  resets  the  startup information for the service to whatever is specified in the init script in question.

  By default, the on and off options affect only runlevels 2, 3, 4, and 5,  while  reset affects  all  of  the runlevels.  The --level option may be used to specify which run-levels are affected.

  Note that for every service, each runlevel has either a start script or a stop script.

  When  switching runlevels, init will not re-start an already-started service, and will not re-stop a service that is not running.

  chkconfig also can manage xinetd scripts  via  the  means  of  xinetd.d  configuration files. Note that only the on, off, and --list commands are supported for xinetd.d ser-vices.

OPTIONS
  --level levels
    Specifies the run levels an operation should pertain  to.  It  is  given  as  a string  of  numbers  from 0 to 7. For example, --level 35 specifies runlevels 3 and 5.

  --add name
    This option adds a new service for management by chkconfig.  When a new service is added, chkconfig ensures that the service has either a start or a kill entry in every runlevel. If any runlevel is missing such an entry, chkconfig  creates the  appropriate  entry  as specified by the default values in the init script.
  Note that default entries in LSB-delimited ’INIT INFO’ sections take precedence over the default runlevels in the initscript.

  --del name
    The  service  is  removed  from chkconfig management, and any symbolic links in /etc/rc[0-6].d which pertain to it are removed.

    Note that future package installs for this service  may  run  chkconfig  --add, which will re-add such links. To disable a service, run chkconfig name off.

  --list name
    This  option lists all of the services which chkconfig knows about, and whether they are stopped or started in each runlevel. If name is specified, information in only display about service name.

RUNLEVEL FILES
  Each service which should be manageable by chkconfig needs two or more commented lines added to its init.d script. The first line tells chkconfig what runlevels the  service should be started in by default, as well as the start and stop priority levels. If the service should not, by default, be started in any runlevels, a -  should  be  used  in place  of the runlevels list.  The second line contains a description for the service, and may be extended across multiple lines with backslash continuation.

  For example, random.init has these three lines:
  # chkconfig: 2345 20 80
  # description: Saves and restores system entropy pool for \
  #              higher quality random number generation.
  This says that the random script should be started in levels 2, 3, 4, and 5, that  its start  priority  should be 20, and that its stop priority should be 80.  You should be able to figure out what the description says; the \ causes the line to  be  continued.
       The extra space in front of the line is ignored.


Posted by 두장

리눅스에서 현재 시스템 시간 확인

# date


시스템의 하드웨어에 입력되어 있는 시간 출력

# clock


시스템 시간을 하드웨어 시간에 입력

# clock -w


실제 현재 시간과 시스템에 설정된 시간이 다를 경우가 있다.
이때 보라넷 서버 시간과 일치시키기 위해 아래와 같이 하면된다.
(보라넷 서버 시간은 실제 현재 시간과 일치하기때문에)

# rdate -s time.bora.net && clock -w


아래와 같이 하면 리눅스의 시간을 임의로 설정 할수도 있다.

다음은 2009년 06월 30일 15시 55분으로 시스템의 시간을 설정하는 명령어이다. 

# date 063015522009


Posted by 두장

/etc/ssh/ 폴더에 sshd_config 파일이 있다.

ssh 연결과 관련된 여러가지 환경 정보 파일이다.

그 중에 아래 부분이 인증 관련된 부분이다...

# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes


특히 PermitRootLogin 관련된 것이 root 로그인을 허용할지를 결정 하는 부분이다..

로그인을 허용하려면 "yes"로 만들고, 허용하지 않으려면  "no"로 바꾸어 저장하면 된다

환경 정보를 바꾸었으면  아래와 같이 입력하여 ssh 데몬을 재시작 해주어야 한다.

 /etc/rc.d/init.d/sshd restart

서버가 Linux 임에도 불구하고 아래와 같은 오류 메시지가 뜨면서

접속을 막혀 있을 경우 위 환경 정보 파일을 수정해 주면 대부분 해결 할 가능 하다.

 ssh: connect to host 168.188.46.105 port 22: Connection refused



Posted by 두장
이전버튼 1 이전버튼