第十一章 开启SSH服务
1、安装时选择上SSH,或者源码安装SSH,并设置开机自启动服务
2、使用root登陆系统
3、使用vi编辑器编辑/etc/inetd.conf,去掉ssh前的#,按ctrl+c,再输入exit保存退出(如果是后续安装服务的情况)
4、编辑/etc/rc.conf,添加以下内容(如果是后续安装服务的情况)
sshd_enable="YES"或用以下命令
# sysrc sshd_enable="YES"5、编辑/etc/ssh/sshd_config,修改以下内容,保存退出
#port=22 改为 Port=number //你想修改的数字
#PermitRootLogin no 改为 PermitRootLogin yes //允许root登陆
#PasswordAuthentication no 改为 PasswordAuthentication yes //使用系统PAM认证
#PermitEmptyPasswords no 改为 PermitEmptyPasswords no //不允许空密码
#UseDNS no 改为 UseDNS no
#GSSAPIAuthentication no 改为 GSSAPIAuthentication no //提升ssh登录速度6、重启SSH服务
/etc/rc.d/sshd restart7、查看服务是否启动,netstat -an,如果看到22端口有监听,恭喜!!!
额外说明:
优化SSH连接速度(默认是最优状态,不需要优化,只需要确认配置参数即可)
最后更新于