zoukankan      html  css  js  c++  java
  • ubuntu16.04服务器配置ssh免密登录

        原版资料英文,链接在此  https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2

    在客户端操作
    ssh-keygen -t rsa
    文件位置写/home/try/.ssh/server_rsa,不使用默认值,我命名为server_rsa担心影响到git的key(因为我的git使用的是默认值)
    ssh-copy-id   root@123.45.56.78(你的服务器ip),
    或这使用
    cat ~/.ssh/id_rsa.pub | ssh user@123.45.56.78 "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"
    即可将,你的客户端key传到服务器的~/.ssh/authorized_keys文件中,也可手动复制进去。
     
    在服务器端操作
         sudo nano /etc/ssh/sshd_config
         更改这条为without-password,实现root免密登录
         即  PermitRootLogin without-password

    ssh简写技巧
              vim  ~/.ssh/config
     
         添加
         Host   lisa  随便起的,好记就行
         HostName 188.166.225.189  你的服务器ip
         User root
              
         Port  9999(端口自定,推荐不加)    (后两条我未曾用到,前三条足以)
         IdentityFile ~/.ssh/id_rsa   认证的key位置,如果已经传到服务器就不用这条了
     
         可实现使用 ssh lisa  来代替 ssh root@188.166.225.186的效果
     
  • 相关阅读:
    luogu P1144 最短路计数
    codevs 1006 等差数列
    luogu P2419 [USACO08JAN]牛大赛Cow Contest
    luogu cogs 选数
    luogu P1186玛丽卡
    leetcode[69]Sqrt(x)
    leetcode[70]Climbing Stairs
    leetcode[71]Simplify Path
    leetcode[72]Edit Distance
    leetcode[73]Set Matrix Zeroes
  • 原文地址:https://www.cnblogs.com/iamhenanese/p/6014479.html
Copyright © 2011-2022 走看看