ubuntu16.04伺服器配置ssh免密登入,ubuntu16.04ssh

來源:互聯網
上載者:User

ubuntu16.04伺服器配置ssh免密登入,ubuntu16.04ssh
原版資料英文,連結在此  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-passwordssh簡寫技巧          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的效果 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.