安装openssh服务
------------------------------------------------------------------------------------------------------------------
备份ssh:
mv /etc/ssh /etc/ssh_`date +%F`
编译安装:
tar -zxf openssh-9.0p1.tar.gz
cd openssh-9.0p1
./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-zlib --with-md5-passwords --with-pam
make
make install
修改配置文件:
mv /etc/init.d/sshd /etc/init.d/sshd_`date +%F`
mv /etc/pam.d/sshd.pam /etc/pam.d/sshd.pam_`date +%F`
cp -a contrib/redhat/sshd.init /etc/init.d/sshd
cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
chmod +x /etc/init.d/sshd
重启服务,配置开机自启:
把原先的systemd管理的sshd文件删除或者移走或者删除,不移走的话影响我们重启sshd服务
mv /run/systemd/generator.late/sshd.service /run/systemd/generator.late/sshd.service_`date +%F`
设置开机自启:
chkconfig --add sshd
chkconfig sshd on
systemctl enable sshd
重启sshd:
systemctl restart sshd
-------------------------------------------------------------------------------------------------------------------
报错处理区:
-------------------------------------------------------------------------------------------------------------------
报错1:
configure: error: OpenSSL library not found.
处理方式:
CCFLAGS=“-I/usr/local/openssl/include" LDFLAGS=“-L/usr/local/openssl/lib" ./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-zlib --with-md5-passwords --with-pam
报错2:
configure: error: *** OpenSSL headers missing - please install first or check config.log
处理方式:
重新安装openssl服务
报错3:
openssh升级报错configure: error: Your OpenSSL headers do not match your library. Check config.log for d
处理方法:
./configure 中增加--without-openssl-header-check
报错4:
升级openssh报 PAM headers not found
处理方法:
yum -y install pam-devel
报错5:
升级openssh报error: *** zlib.h missing - please install first or check config.log
处理方法:
yum -y install zlib zlib-devel
-------------------------------------------------------------------------------------------------------------------
开启root登录、ssh端口和密码登录:
vim /etc/ssh/sshd_config
#Port 22 改为 Port 你的ssh端口
#PermitRootLogin prohibit-password 改为 PermitRootLogin yes #运行root账号远程登录
#PasswordAuthentication yes 改为 PasswordAuthentication yes #开启密码认证
#UsePAM no 改为 UsePAM yes #开启UsePAM登录
评论
请 登录后发表观点
暂无数据
- 积分
420 - 话题
88 - 评论
6 - 注册排名
83