linux之ssh远程登录
linux之ssh远程登录
登录远程服务器:
Windows下使用putty绿色软件可以实现远程登录linux服务器,比较简单。着重介绍linux下ssh的远程登陆:
#安装sh服务器edemon@linux:~$ sudo apt-get install ssh #ssh远程登录,查看系统IP:edemon@linux:~$ ifconfigeth0 Link encap:Ethernet HWaddr 18:67:b0:24:0a:2e inet addr:202.118.212.121 Bcast:202.118.212.255 Mask:255.255.255.0 inet6 addr: fe80::1a67:b0ff:fe24:a2e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:33105 errors:0 dropped:0 overruns:0 frame:0 TX packets:15454 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:15351706 (15.3 MB) TX bytes:2159698 (2.1 MB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:2667 errors:0 dropped:0 overruns:0 frame:0 TX packets:2667 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:293266 (293.2 KB) TX bytes:293266 (293.2 KB)#使用用户jordan登录edemon@linux:~$ ssh -l jordan 202.118.212.121jordan@202.118.212.121's password: Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-15-generic i686)## ...#Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted byapplicable law. $ pwd/home/jordan$ exit #退出Connection to 202.118.212.121 closed. #尝试进入另一个地址:edemon@linux:~$ ssh -l jordan 127.0.0.1The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.ECDSA key fingerprint is 3f:80:32:87:65:64:93:02:2a:98:66:39:34:6d:05:94.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.jordan@127.0.0.1's password: Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-15-generic i686)## ...#Last login: Tue Mar 8 16:21:56 2016 from 202.118.212.121$ #远程登录,使用图形界面程序:edemon@linux:~$ ssh -X -l jordan 202.118.212.121jordan@202.118.212.121's password: Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-15-generic i686)## 前提是开放了图形界面端口# 修改文件 sshd_config 保证其有如下内容:# AllowTcpForwarding yes# X11Forwarding yes#$ firefox #使用ssh密钥快速登录多台服务器:#使用ssh生成密钥:公钥存在于服务器中,私钥是自己的。#默认情况下生成RSA加密的密钥文件:#密码掩码:提高密码防御恶意攻击的能力加入的干扰码。Enter passphrase (empty for no passphrase): Your identification has been saved in /home/edemon/.ssh/id_rsa.Your public key has been saved in /home/edemon/.ssh/id_rsa.pub.The key fingerprint is:dc:ab:68:67:09:c6:fb:69:6e:af:a6:7e:f2:5e:44:67 edemon@linuxThe key's randomart image is:+---[RSA 2048]----+| || || . E || . o o || . S o || + . . || . o .o || +.O+ || o+#Oo. |+-----------------+ #创建隐藏类文件(目录):$ mkdir .ssh#仅当前用户有读写权限:$ chmod 700 .ssh #将服务器端的.pub文件复制到客户端路径文件夹再次登录就不需要输入密码了。 edemon@linux:~$ scp .ssh/id_rsa.pub jordan@202.118.212.121:/home/jordan/.ssh/authorized_keysjordan@202.118.212.121's password: id_rsa.pub 100% 394 0.4KB/s 00:00 edemon@linux:~$ ssh -l jordan 202.118.212.121Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-15-generic i686)
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~