Ubuntu 16.04 LTS中沒有.ssh文件,該如何解決呢?


這是因為沒有安裝ssh軟件。

1.安裝。

  sudo apt install openssh-server  或者  sudo apt-get install openssh-server

2.啟動ssh。

  sudo /etc/init.d/ssh resart 

3.確認 ssh-server 是否啟動。

  ps -e | grep ssh

  如果只有 ssh-agent 那說明 ssh-server 還沒有啟動,需要 sudo /etc/init.d/ssh start,如果看到sshd那說明ssh-server已經啟動了。

4.創建私鑰,用於遠程登錄時的免密碼登錄(即:只要有一次輸入密碼登錄成功后,下次登錄時就不需要再輸入密碼就可以直接登錄了)。

  ssh-keygen

  該步驟,會生成兩個文件,id_rsa(私鑰)id_rsa.pub(公鑰)

操作如下圖所示:

chen@ubuntu:~$ sudo apt install openssh-server
[sudo] chen 的密碼: 
正在讀取軟件包列表... 完成
正在分析軟件包的依賴關系樹       
正在讀取狀態信息... 完成       
openssh-server 已經是最新版 (1:7.2p2-4ubuntu2.4)。
升級了 0 個軟件包,新安裝了 0 個軟件包,要卸載 0 個軟件包,有 2 個軟件包未被升級。
chen@ubuntu:~$ sudo /etc/init.d/ssh restart 
[ ok ] Restarting ssh (via systemctl): ssh.service.
chen@ubuntu:~$ ps -e | grep ssh
  1884 ?        00:00:00 ssh-agent
  5936 ?        00:00:00 sshd
chen@ubuntu:~$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/chen/.ssh/id_rsa): 
Created directory '/home/chen/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/chen/.ssh/id_rsa.
Your public key has been saved in /home/chen/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:oynEdTWEUxfMmG1/c1tBFW7krVgdP+LZ2XtcRaPcgQQ chen@ubuntu
The key's randomart image is:
+---[RSA 2048]----+
|         +=E=ooB=|
|        o.oo*.*+*|
|      . .. . =.**|
|   . . .    .o*oO|
|    o   S   .o.+B|
|   .   o .     oo|
|    . o        .o|
|     .          .|
|                 |
+----[SHA256]-----+
chen@ubuntu:~$ 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM