SSH安装

  1. # 安装 SSH ,默认启动
  2. apt install openssh-server -y
  3. # 启动 ssh
  4. /etc/init.d/ssh start
  5. # 重启 ssh
  6. /etc/init.d/ssh restart
  7. # 查看 ssh 状态
  8. /etc/init.d/ssh status
  9. # 关闭 ssh
  10. /etc/init.d/ssh stop

修改用户密码,例如root

 sudo passwd root

允许用户使用root账户远程连接

# 开启远程连接
vim /etc/ssh/sshd_config

# 找到 #PasswordAuthentication yes  把#的注释去掉
PasswordAuthentication yes
# 将 #PermitRootLogin prohibit-password 修改为:PermitRootLogin yes
PermitRootLogin yes
# 重启 SSH 服务
/etc/init.d/ssh start
# 设置开机自启
update-rc.d ssh enable