浅谈SSH(3)之SSH登陆测试

本文发布时间: 2019-Mar-21
当你使用ssh从本机登录到远程主机时,你可能希望切换到本地做一些操作,然后再重新回到远程主机。这个时候,你不需要中断ssh连接,那么我们该如何保持链接并且本地操作呢?当你已经登录到了远程主机时,你可能想要回到本地主机进行一些操作,然后又继续回到远程主机。在这种情况下,没有必要断开远程主机的会话,你可以用下面的办法来完成:首先登入远程主机,localhost$ ssh -l yeslabremotehost要临时回到本地主机,输入退出符号:“~”与“Ctrl-Z”组合。当你输入“~”你不会立即在屏幕上看到,当你按下<Ctrl-Z>并且按回车之后才一起显示。如下,在远程主机中以此输入“~<Ctrl-Z>”remotehost$ ~^Z[1]+ Stopped ssh -l yeslabremotehost现在你已经退回到了本地主机,ssh远程客户端会话就在UNIX后台中运行,你可以向下面那样查看它:localhost$ jobs[1]+ Stopped ssh -l yeslabremotehost你可以将后台运行的ssh会话进程切换到前台,重新回到远程主机,而无需输入密码localhost$ fg %1ssh -l yeslabremotehostremotehost$到此就大功告成了,那么用SSH退出字符会话,要想取得一些关于当前会话有用的信息,可以按以下方式完成。不过这只能在SSH 2 客户端上使用。首先登录到远程服务器localhost$ ssh -l yeslabremotehost如下所示,在远程服务器上,输入ssh退出字符~并输入s。这样会显示出很多有关当前ssh连接的有用信息remotehost$ [注:当你在命令行上输入~s时,它是不可见的.]remote host: remotehostlocal host: localhostremote version: SSH-1.99-OpenSSH_3.9p1local version: SSH-2.0-3.2.9.1 SSH Secure Shell (non-commercial)compressed bytes in: 1506uncompressed bytes in: 1622compressed bytes out: 4997uncompressed bytes out: 5118packets in: 15packets out: 24rekeys: 0Algorithms:Chosen key exchange algorithm: diffie-hellman-group1-sha1Chosen host key algorithm: ssh-dssCommon host key algorithms: ssh-dss,ssh-rsaAlgorithms client to server:Cipher: aes128-cbcMAC: hmac-sha1Compression: zlibAlgorithms server to client:Cipher: aes128-cbc MAC: hmac-sha1Compression: zliblocalhost$以上就是Linux下SSH的常用操作及相关的使用方法,希望能够对你有所帮助。


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:08pm
栏目列表