로그인
Sign in
zlib 설치 후

./configure --with-zlib=/usr/local


mkdir /var/empty
chown root:sys /var/empty
chmod 755 /var/empty
groupadd sshd
useradd -g sshd -c 'sshd privsep' -d /var/empty -s /bin/false sshd


[wbnapp@root:/sbin/init.d]cat secsh
#!/sbin/sh

#
# sshd.rc: SSH daemon start-up and shutdown script
#

# Allowed exit values:
#       0 = success; causes "OK" to show up in checklist.
#       1 = failure; causes "FAIL" to show up in checklist.
#       2 = skip; causes "N/A" to show up in the checklist.
#           Use this value if execution of this script is overridden
#           by the use of a control variable, or if this script is not
#           appropriate to execute for some other reason.
#       3 = reboot; causes the system to be rebooted after execution.

# Input and output:
#       stdin is redirected from /dev/null
#
#       stdout and stderr are redirected to the /etc/rc.log file
#       during checklist mode, or to the console in raw mode.

PATH=/usr/sbin:/usr/bin:/sbin:/usr/local/bin
export PATH

WHAT='HP-UX Secure Shell'
WHAT_PATH=/usr/local/sbin/sshd
WHAT_PID=/var/run/sshd.pid
WHAT_CONFIG=/etc/rc.config.d/sshd

# NOTE: If your script executes in run state 0 or state 1, then /usr might
#       not be available.  Do not attempt to access commands or files in
#       /usr unless your script executes in run state 2 or greater.  Other
#       file systems typically not mounted until run state 2 include /var
#       and /opt.

rval=0

# Check the exit value of a command run by this script.  If non-zero, the
# exit code is echoed to the log file and the return value of this script
# is set to indicate failure.

set_return() {
        x=$?
        if [ $x -ne 0 ]; then
                echo "EXIT CODE: $x"
                rval=1  # script FAILed
        fi
}

case $1 in
'start_msg')
        echo "Starting $WHAT"
        ;;

'stop_msg')
        echo "Stopping $WHAT"
        ;;

'start')
        if [ -f $WHAT_CONFIG ] ; then
                . $WHAT_CONFIG
        else
                echo "ERROR: $WHAT_CONFIG defaults file MISSING"
        fi
#       umask 000
        umask ${SSHD_UMASK:-000}
        ps -ef | grep "/usr/local/sbin/sshd" | grep -v grep > /dev/null
        NOT_RUNNING=$?
        if [ "$SSHD_START" -eq 1 -a -x "$WHAT_PATH" -a "$NOT_RUNNING" -eq 1 ]; then
                $WHAT_PATH $SSHD_ARGS && echo "$WHAT started"
                set_return
        else
                rval=2
        fi
        ;;

'stop')
        if [ -f $WHAT_PID ]; then
                if kill `cat $WHAT_PID`; then
                        echo "$WHAT stopped"
                 else
                         rval=1
                         echo "Unable to stop $WHAT"
                 fi
        else
                rval=2
        fi
        set_return
        ;;

*)
        echo "usage: $0 {start|stop|start_msg|stop_msg}"
        rval=1
        ;;
esac

exit $rval



----------------------------------------------------------------------------

[wbnapp@root:/sbin/init.d]cat /etc/rc.config.d/sshd
# SSHD_START:           Set to 1 to start SSH daemon
# SSHD_ARGS:            Command line arguments to pass to sshd
#
SSHD_START=1
SSHD_ARGS=
SSHD_UMASK=000          #The acceptable values of this variable are found by doing man umask
List of Articles
번호 제목 글쓴이 날짜 조회 수
공지 자주 사용하는 명령어 제비게릴라 2019-06-27 179
192 리눅스 테스트 프로그램 하록 2012-07-10 613
» hpux sshd 소스 컴파일시 하록 2012-07-09 2550
190 iscsi 설정 하록 2012-06-21 490
189 리눅스 dm-0같은 볼륨 확인 방법 [1] 하록 2012-06-18 567
188 php 파일 실행시 내용 보여줄때.. 하록 2012-03-14 473
187 vi 한글 쓰기... [1] 하록 2011-12-08 859
186 프로세스 별 Disk I/O 확인 방법 file 하록 2011-11-02 1609
185 sysrq 값에 대한 자료 하록 2011-11-01 549
184 lsof 포트 확인 방법 하록 2011-10-26 690
183 linux NTFS 사용... file 하록 2011-06-28 600
182 사용중인 포트의 프로세스 찾기 하록 2011-06-02 719
181 passwd, shadow 필드 설명 하록 2011-05-04 1107
180 hadoop 미사용 서버 확인.. 하록 2011-04-15 611
179 Too many open files in system 해결 방법... 하록 2011-04-13 1052
178 rcmd: socket: All ports in use 하록 2011-04-07 2677
177 nfs - nfs fstab 형식과 옵션 하록 2011-03-28 928
176 http error 메세지 하록 2011-03-25 521
175 FTP Error 메세지... 하록 2011-03-25 556
174 보안을 위한 /etc/sysctl.conf 파일 수정 하록 2011-03-22 527
173 logrotate Shell 파일.... 하록 2011-02-01 361