리눅스 (Linux)2015. 12. 24. 23:55

openssh를 centos6.x에 설치시 필요
./configure --prefix=/usr/local/openssh --with-tcp-wrappers --with-pam --with-md5-passwords
gcc
pam-devel
-------------------------------------------------------------------------------------------------------

./configure --prefix=/usr/local/openssh --with-tcp-wrappers --with-pam --with-md5-passwords

성공했다. 이제 make && make install을 진행하자.

[root@localhost openssh-6.6p1]# make


[root@localhost openssh-6.6p1]# make install


--------------------------------------------------------------------------------------------------------
아래 키파일이 다 있는지 확인하여 없으면 find로 찾아 복사해준다
               /sbin/restorecon /usr/local/openssh/etc/ssh_host_key.pub
               /sbin/restorecon /usr/local/openssh/etc/ssh_host_rsa_key.pub
               /sbin/restorecon /usr/local/openssh/etc/ssh_host_dsa_key.pub
               /sbin/restorecon /usr/local/openssh/etc/ssh_host_ecdsa_key.pub

파일이 없을경우 find로 찾아준다
# find / -name ssh_host_key.pub


openssh 삭제

[root@localhost ~]# rpm -e openssh-clients-5.3p1-104.el6.x86_64
[root@localhost ~]# rpm -e openssh-server-5.3p1-104.el6.x86_64
[root@localhost ~]# rpm -e openssh-5.3p1-104.el6.x86_64


여기부터 설정


설치 스크립트 복사

[root@localhost openssh-6.6p1]# cp /usr/local/src/openssh-7.1p1/contrib/sshd.pam.generic /etc/pam.d/sshd
[root@localhost openssh-6.6p1]# cp /usr/local/src/openssh-7.1p1/contrib/redhat/sshd.init /etc/init.d/sshd
 

[root@localhost openssh-6.6p1]# vim /etc/init.d/sshd

25번줄 - SSHD=/usr/local/openssh/sbin/sshd로 변경
         SSHD=/usr/local/openssh/sbin/sshd

41번줄 - /usr/local/openssh/bin/ssh-keygen -A 로 변경
         /usr/local/openssh/bin/ssh-keygen -A


43번줄
               /sbin/restorecon /usr/local/openssh/etc/ssh_host_key.pub
               /sbin/restorecon /usr/local/openssh/etc/ssh_host_rsa_key.pub
               /sbin/restorecon /usr/local/openssh/etc/ssh_host_dsa_key.pub
               /sbin/restorecon /usr/local/openssh/etc/ssh_host_ecdsa_key.pub



[root@localhost openssh-6.6p1]# export PATH=$PATH:/usr/local/openssh/bin:/usr/local/openssh/sbin
[root@localhost openssh-6.6p1]# ssh -V
OpenSSH_6.6p1, OpenSSL 1.0.1e-fips 11 Feb 2013

sshd start 로 스크립트가 정상인지 테스트
[root@localhost openssh-6.6p1]# /etc/init.d/sshd start
/etc/init.d/sshd: line 41: /usr/local/openssh/ssh-keygen: No such file or directory
/sbin/restorecon:  lstat(/etc/ssh/ssh_host_ecdsa_key.pub) failed:  No such file or directory
Starting sshd:                                             [  OK  ]
[root@localhost openssh-6.6p1]#


스크립트 정상인지 확인되면 재시작
[root@localhost openssh-6.6p1]# /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]


[root@localhost openssh-6.6p1]# ps -ef | grep sshd
root     23081     1  0 15:41 ?        00:00:00 /usr/local/openssh/sbin/sshd



성공...



Posted by 랩퍼우