最近工作中需要远程自己的ubuntu电脑,使用的是ssh进行连接,所以需要给ubuntu安装个ssh服务,这里把自己安装配置的过程,以及遇到的问题做个总结。

ubuntu16.04安装配置ssh服务以及root登录

工具/原料

  • ubuntu16.04系统

方法/步骤

  1. 进入ubuntu16.04桌面右键“打开终端”。

    ubuntu16.04安装配置ssh服务以及root登录
  2. 使用apt安装openssh服务。

    sudo  apt-get install   openssh-server

    ubuntu16.04安装配置ssh服务以及root登录
  3. 编辑配置文件,让其支持root用户登录,因为默认是不支持root用户的。

    sudo gedit   /etc/ssh/sshd_config

    ubuntu16.04安装配置ssh服务以及root登录
  4. 把其中的“PermitRootLogin prohibit-password” 修改为“PermitRootLogin  yes”。

    ubuntu16.04安装配置ssh服务以及root登录
  5. 重启openssh服务。

    systemctl   restart    sshd(server服务)

    ubuntu16.04安装配置ssh服务以及root登录
  6. 弹出窗口提示输入用户密码,然后确定授权。

    ubuntu16.04安装配置ssh服务以及root登录
  7. 现在我们就可以使用putty等客户端连接我们的ssh服务了,root用户也是可以登录的。

    ubuntu16.04安装配置ssh服务以及root登录
    ubuntu16.04安装配置ssh服务以及root登录