OS 기술/Linux

OpenSSH 9.3p2 오픈소스 설치 명령어 모음 (CentOS 7 기준)

DongT 2023. 8. 2. 17:39
728x90
반응형

=======================================================

 

yum install -y wget

 

wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.3p2.tar.gz

 

tar -zxvf openssh-9.3p2.tar.gz

cd openssh-9.3p2

 

yum install -y gcc

yum install -y zlib-devel

yum install -y openssl-devel

yum install -y pam-devel

rpm -qa | grep 'gcc\|zlib-devel\|openssl-devel\|pam-devel'

 

./configure --prefix=/usr/local/openssh --with-ssl-dir=/bin --with-pam

 

make && make install

 

mv /lib/systemd/system/sshd.service /etc/systemd/system/sshd.service

cp /etc/ssh/sshd_config /usr/local/openssh/etc/sshd_config_ori

 

 

cat << EOF > /etc/systemd/system/sshd.service

[Unit]

Description=OpenSSH server daemon fix

#Documentation=man:sshd(8) man:sshd_config(5)

#After=network.target sshd-keygen.service

Wants=sshd-keygen.service

 

[Service]

#Type=notify

#EnvironmentFile=/etc/sysconfig/sshd

#ExecStart=/usr/sbin/sshd -D $OPTIONS

ExecStart=/usr/local/openssh/sbin/sshd

#ExecReload=/bin/kill -HUP $MAINPID

#KillMode=process

Restart=on-failure

RestartSec=10s

 

[Install]

WantedBy=multi-user.target

EOF

 

 

systemctl daemon-reload

systemctl restart sshd

systemctl status sshd

 

 

rpm -e --nodeps openssh openssh-server openssh-clients

 

systemctl restart sshd

systemctl status sshd

systemctl enable sshd

 

ln -s /usr/local/openssh/bin/ssh /bin/ssh

ln -s /usr/local/openssh/bin/sftp /bin/sftp

 

=======================================================

 

728x90