切换到root用户
#更新软件源
apt-get update
安装ssh
apt-get install ssh
备份ssh的配置文件
cp /etc/ssh/sshd_config{,.bak}
修改配置文件如下
root@localhost:~# more /etc/ssh/sshd_config| grep -v "^#" |grep -v "^$"
Include /etc/ssh/sshd_config.d/*.conf
Port 22
PermitRootLogin prohibit-password
PasswordAuthentication yes
PermitEmptyPasswords no
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
注释 grep -v “^#” |grep -v “^$” 去空格和#开头
启动ssh
service sshd start
service ssh status
添加开机启动
update-rc.d ssh enable
移除启动
update-rc.d ssh remove
查看添加的启动程序
ll /etc/rc2.d