linux和windows创建ssh链接

纯命令行linux下载太费劲了,安装一个ssh轻松一点,用windows下载,传输到linux后tar安装。

1.linux安装openssh(不记得具体的命令的,大概是这样 参考https://blog.csdn.net/qq_38701476/article/details/81135428)

sudo apt-get install openssh-server

2.su启动ssh

service ssh start

  

如果提示以下内容,则还需要生成key才可以

Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key

 

参考:http://blog.sina.com.cn/s/blog_b5dfe4870102yg59.html 

oenSSH服务器第一次安装到Linux系统时,SSH主机密钥应该会自动生成以供后续使用。如果密钥生成过程没有成功完成,那就会导致这样的SSH登录问题。

 

解决方法:

在Debian、Ubuntu或其衍生版上,你可以使用dpkg-reconfigure工具来重新生成SSH主机密钥,过程如下:


  1. $ sudo rm -r /etc/ssh/ssh*key
  2. $ sudo dpkg-reconfigure openssh-server

 

3.获取linux本地IP地址,在其他机器上通过ssh访问该IP地址

root@Yzz:/etc/ssh# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:f9ff:fe75:432b  prefixlen 64  scopeid 0x20<link>
        ether 02:42:f9:75:43:2b  txqueuelen 0  (Ethernet)
        RX packets 63  bytes 30458 (30.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 84  bytes 6604 (6.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.24.174.126  netmask 255.255.240.0  broadcast 172.24.175.255
        inet6 fe80::215:5dff:fef0:5e5  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:f0:05:e5  txqueuelen 1000  (Ethernet)
        RX packets 374033  bytes 522539167 (522.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 127209  bytes 7606447 (7.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 40  bytes 11324 (11.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 40  bytes 11324 (11.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

  

在windows的cmd中访问

C:\WINDOWS\system32>ssh 172.24.174.126
The authenticity of host ‘172.24.174.126 (172.24.174.126)‘ can‘t be established.
ECDSA key fingerprint is SHA256:T6lBm6KE3Nu3PFEuTxkGxwjORdLwsgfh47koumD5E6M.
Are you sure you want to continue connecting (yes/no)?

  

linux和windows创建ssh链接

上一篇:HDU 1081 求子矩阵和最大值


下一篇:PTA basic 1081 检查密码 (15 分) c++语言实现(g++)