1、依赖安装
yum -y install gcc gcc-c++;
yum install openssl-devel;
yum -y install pam-devel;
yum install zlib-devel;
2、进入到openssh8解压目录中
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-openssl-includes=/usr --with-privsep-path=/var/lib/sshd;
make && make install;
3、复制文件及授权
install -v -m755 contrib/ssh-copy-id /usr/bin;
install -v -m644 contrib/ssh-copy-id.1 /usr/share/man/man1;
install -v -m755 -d /usr/share/doc/openssh-8.0p1;
install -v -m644 INSTALL LICENCE OVERVIEW README* /usr/share/doc/openssh-8.0p1;
4、设置文件权限
chmod 640 /etc/ssh/ssh_host_rsa_key;
chmod 640 /etc/ssh/ssh_host_ecdsa_key;
chmod 640 /etc/ssh/ssh_host_ed25519_key;
chmod 620 /etc/ssh/moduli ;
chmod 600 /etc/ssh/sshd_config /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_rsa_key;
chmod 644 /etc/ssh/ssh_config /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_rsa_key.pub;
chmod 600 /etc/ssh/ssh_host_ecdsa_key;
chmod 600 /etc/ssh/ssh_host_ed25519_key;
5、设置root用户远程连接
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config;
6、设置ssh服务开机启动
cp -p contrib/redhat/sshd.init /etc/init.d/sshd;
chmod +x /etc/init.d/sshd;
chkconfig --add sshd;
chkconfig sshd on;
/etc/init.d/sshd restart;
7、检查服务状态
systemctl start sshd;
systemctl status sshd;
journalctl -xe;
sshd -t
没有任何打印,代表服务安装完成