美文网首页
Ubuntu 的一些安全配置

Ubuntu 的一些安全配置

作者: Pengx | 来源:发表于2016-08-25 17:08 被阅读40次

    环境


    Ubuntu 16.04 i386

    免密码登陆

    • 生成秘钥
    $ ssh-keygen -t rsa
    
    • 上传秘钥
    $ ssh-copy-id -i ~/.ssh/id_rsa.pub root@[ip address] -p [port]
    
    禁止 SSH 密码登陆

    $ vi /etc/ssh/sshd_config
    

    找到

    #PasswordAuthentication yes
    

    去掉注释并将PasswordAuthentication 设置为 no

    PasswordAuthentication no
    

    保存并退出后重启 SSH 服务

    $ service ssh restart
    
    更改默认端口

    $ vi /etc/ssh/sshd_config
    

    修改默认端口 22 为其他可用端口

    Port xxxx
    

    可用端口号参考 Wiki

    保存并退出后重启 SSH 服务

    $ service ssh restart
    

    相关文章

      网友评论

          本文标题:Ubuntu 的一些安全配置

          本文链接:https://www.haomeiwen.com/subject/pylasttx.html