这是因为没有安装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-******

  该步骤,会生成两个文件,id_rsa(私钥)id_rsa.pub(公钥)

操作如下图所示:

Ubuntu 16.04 LTS中没有.ssh文件,该如何解决呢?

[email protected]:~$ sudo apt install openssh-server
[sudo] chen 的密码: 
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
openssh-server 已经是最新版 (1:7.2p2-4ubuntu2.4)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 2 个软件包未被升级。
[email protected]:~$ sudo /etc/init.d/ssh restart 
[ ok ] Restarting ssh (via systemctl): ssh.service.
[email protected]:~$ ps -e | grep ssh
  1884 ?        00:00:00 ssh-agent
  5936 ?        00:00:00 sshd
[email protected]:~$ ssh-****** 
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 [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|         +=E=ooB=|
|        o.oo*.*+*|
|      . .. . =.**|
|   . . .    .o*oO|
|    o   S   .o.+B|
|   .   o .     oo|
|    . o        .o|
|     .          .|
|                 |
+----[SHA256]-----+
[email protected]:~$ 

Ubuntu 16.04 LTS中没有.ssh文件,该如何解决呢?

 

我的GitHub地址:https://github.com/heizemingjun
我的博客园地址:http://www.cnblogs.com/chenmingjun
我的蚂蚁笔记博客地址:http://blog.leanote.com/chenmingjun
Copyright ©2018 黑泽明军
【转载文章务必保留出处和署名,谢谢!】

相关文章:

  • 1970-01-01
  • 2021-03-29
  • 2021-08-27
  • 2021-11-30
  • 2021-05-21
  • 2021-11-26
  • 2021-07-05
  • 2021-09-12
猜你喜欢
  • 2021-11-28
  • 2022-01-02
  • 2021-07-28
  • 2022-02-16
  • 2021-12-23
  • 2021-06-28
相关资源
相似解决方案