成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Linux下SSH命令使用方法詳解

系統(tǒng) Linux
1、查看SSH客戶端版本 有的時候需要確認一下SSH客戶端及其相應(yīng)的版本號。使用ssh -V命令可以得到版本號。需要注意的是,Linux一般自帶的是OpenSSH: 下面的例子即表明該系統(tǒng)正在使用OpenSSH: $ ssh -V OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003

 1、查看SSH客戶端版本

有的時候需要確認一下SSH客戶端及其相應(yīng)的版本號。使用ssh -V命令可以得到版本號。需要注意的是,Linux一般自帶的是OpenSSH: 下面的例子即表明該系統(tǒng)正在使用OpenSSH:

$ ssh -V 
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003

下面的例子表明該系統(tǒng)正在使用SSH2:

$ ssh -V 
ssh: SSH Secure Shell 3.2.9.1 (non-commercial version) on i686-pc-linux-gnu

2、用SSH登錄到遠程主機

當你第一次使用ssh登錄遠程主機時,會出現(xiàn)沒有找到主機密鑰的提示信息。輸入"yes"后,系統(tǒng)會將遠程主機的密鑰加入到你的主目錄下的 .ssh/hostkeys下,這樣你就可以繼續(xù)操作了。示例如下:

 

1
2
3
4
5
6
7
8
localhost$ ssh -l jsmith remotehost.example.com
Host key not found from database.
Key fingerprint:
xabie-dezbc-manud-bartd-satsy-limit-nexiu-jambl-title-jarde-tuxum
You can get a public key‘s fingerprint by running % ssh-keygen -F publickey.pub on the keyfile.
Are you sure you want to continue connecting (yes/no)? Yes
Host key saved to /home/jsmith/.ssh2/hostkeys/key_22_remotehost.example.com.pub host key for remotehost.example.com,
accepted by jsmith Mon May 26 2008 16:06:50 -0700 jsmith@remotehost.example.com password: remotehost.example.com$

因為遠程主機的密鑰已經(jīng)加入到ssh客戶端的已知主機列表中,當你第二次登陸遠程主機時,只需要你輸入遠程主機的登錄密碼即可。

 

 

1
2
3
localhost$ ssh -l jsmith remotehost.example.com
jsmith@remotehost.example.com password:
remotehost.example.com$

由于各種原因,可能在你第一次登陸遠程主機后,該主機的密鑰發(fā)生改變,你將會看到一些警告信息。出現(xiàn)這種情況,可能有兩個原因:

 

o 系統(tǒng)管理員在遠程主機上升級或者重新安裝了SSH服務(wù)器 
o 有人在進行一些惡意行為,等等。

在你輸入“yes”之前呢,最佳的選擇或許是聯(lián)系你的系統(tǒng)管理員來分析為什么會出現(xiàn)主機驗證碼改變的信息,核對主機驗證碼是否正確。

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
localhost$ ssh -l jsmith remotehost.example.com @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the- middle attack)!
It is also possible that the host key has just been changed.
Please contact your system administrator.
Add correct host key to ―/home/jsmith/.ssh2/hostkeys/key_22_remotehost.example.com.pub‖ to get rid of this message.
Received server key's fingerprint:
xabie-dezbc-manud-bartd-satsy-limit-nexiu-jambl-title-arde-tuxum
You can get a public key's fingerprint by running % ssh-keygen -F publickey.pub on the keyfile.
Agent forwarding is disabled to avoid attacks by corrupted servers.
Are you sure you want to continue connecting (yes/no)? yes
Do you want to change the host key on disk (yes/no)? yes
Agent forwarding re-enabled.
Host key saved to /home/jsmith/.ssh2/hostkeys/key_22_remotehost.example.com.pub host key for remotehost.example.com,
accepted by jsmith Mon May 26 2008 16:17:31 -0700 jsmith @remotehost.example.com's password: remotehost$

3、調(diào)試SSH客戶端會話

 

當ssh連接出現(xiàn)問題時,我們需要通過查看調(diào)試信息來定位這些錯誤。一般來講使用v選項(注意:是小寫的v),即可查看調(diào)試信息。

沒有SSH客戶端調(diào)試信息的例子:

 

1
2
localhost$ ssh -l jsmith remotehost.example.com
warning: Connecting to remotehost.example.com failed: No address associated to the name

包含ssh調(diào)試信息的例子:

 

 

1
2
3
4
5
6
7
8
9
10
locaclhost$ ssh -v -l jsmith remotehost.example.com
debug: SshConfig/sshconfig.c:2838/ssh2_parse_config_ext:
Metaconfig parsing stopped at line 3.
debug: SshConfig/sshconfig.c:637/ssh_config_set_param_verbose:
Setting variable 嘠攀爀戀漀猀攀Mode' to FALSE'.
debug: SshConfig/sshconfig.c:3130/ssh_config_read_file_ext: Read 17 params from config file.
debug: Ssh2/ssh2.c:1707/main: User config file not found, using defaults. (Looked for /home/jsmith/.ssh2/ssh2_config')
debug: Connecting to remotehost.example.com, port 22… (SOCKS not used)
warning: Connecting to remotehost.example.com failed: No address associated to the name
[注:很多命令中,v選項對應(yīng)的英文是 verbose,也就是詳細的信息的意思。]

當你使用ssh從本機登錄到遠程主機時,你可能希望切換到本地做一些操作,然后再重新回到遠程主機。這個時候,你不需要中斷ssh連接,只需要按照第4點的步驟操作即可:

 

4、用SSH退出符切換SSH會話

這個技巧非常實用。尤其是遠程登陸到一臺主機A,然后從A登陸到B,如果希望在A上做一些操作,還得再開一個終端,很是麻煩。

當你使用ssh從本機登錄到遠程主機時,你可能希望切換到本地做一些操作,然后再重新回到遠程主機。這個時候,你不需要中斷ssh連接,只需要按照如下步驟操作即可:

當你已經(jīng)登錄到了遠程主機時,你可能想要回到本地主機進行一些操作,然后又繼續(xù)回到遠程主機。在這種情況下,沒有必要斷開遠程主機的會話,你可以用下面的辦法來完成:

1.登入遠程主機:

localhost$ ssh -l jsmith remotehost

2.已連接遠程主機:

remotehost$

3.要臨時回到本地主機,輸入退出符號:“~”與“Control-Z”組合。

當你輸入“~”你不會立即在屏幕上看到,當你按下<Control-Z>并且按回車之后才一起顯示。如下,在遠程主機中以此輸入“~<Control-Z>”

remotehost$ ~^Z 
[1]+ Stopped ssh -l jsmith remotehost 
localhost$

4.現(xiàn)在你已經(jīng)退回到了本地主機,ssh遠程客戶端會話就在UNIX后臺中運行,你可以向下面那樣查看它:

localhost$ jobs 
[1]+ Stopped ssh -l jsmith remotehost

5. 你可以將后臺運行的ssh會話進程切換到前臺,重新回到遠程主機,而無需輸入密碼

localhost$ fg %1 
ssh -l jsmith remotehost 
remotehost$

5、用SSH退出字符會話,顯示信息

要想取得一些關(guān)于當前會話有用的信息,可以按以下方式完成。不過這只能在SSH 2 客戶端上使用。

登錄到遠程服務(wù)器

localhost$ ssh -l jsmith remotehost

如下所示,在遠程服務(wù)器上,輸入ssh退出字符~并輸入s。這樣會顯示出很多有關(guān)當前ssh連接的有用信息

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
remotehost$ [注:當你在命令行上輸入~s時,它是不可見的.]
remote host: remotehost
local host: localhost
remote version: SSH-1.99-OpenSSH_3.9p1
local version: SSH-2.0-3.2.9.1 SSH Secure Shell (non-commercial)
compressed bytes in: 1506
uncompressed bytes in: 1622
compressed bytes out: 4997
uncompressed bytes out: 5118
packets in: 15
packets out: 24
rekeys: 0
Algorithms:
Chosen key exchange algorithm: diffie-hellman-group1-sha1
Chosen host key algorithm: ssh-dss
Common host key algorithms: ssh-dss,ssh-rsa
Algorithms client to server:
Cipher: aes128-cbc
MAC: hmac-sha1
Compression: zlib
Algorithms server to client:
Cipher: aes128-cbc MAC: hmac-sha1
Compression: zlib
localhost$

以上就是Linux下SSH的詳細使用方法,希望能夠?qū)δ阌兴鶐椭?/p>

【編輯推薦】

  1. Linux中history歷史命令使用方法詳解
  2. Linux下使用mke2fsk格式化分區(qū)的方法
  3. Ubuntu 11.10 利用終端環(huán)境備份還原
責(zé)任編輯:趙寧寧
相關(guān)推薦

2012-05-09 10:52:37

Linux監(jiān)控命令

2012-05-10 10:53:10

Linuxhistory

2010-06-03 17:38:03

Hadoop命令

2009-09-05 10:26:20

Linux壓縮打包命令Linux命令

2009-08-04 08:32:06

Linux Find命Linux Find使用方法

2022-02-26 08:39:09

LinuxScp命令

2010-03-04 10:44:04

Linux ftp命令

2009-09-22 14:17:05

2011-03-25 09:35:07

2010-03-05 15:20:25

Linux man命令

2009-12-28 13:28:03

WPF視頻

2011-08-22 16:23:29

2010-06-01 15:16:36

Zabbix使用

2010-06-01 19:55:30

SVN使用

2022-10-08 09:17:15

Linuxinxi

2010-10-09 10:30:03

JS event

2009-12-02 16:04:44

PHP fsockop

2010-01-28 17:07:03

Android Gal

2009-11-11 10:24:10

linuxecho命令詳解

2021-01-14 07:53:09

Linuxlsof 命令
點贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 性高湖久久久久久久久3小时 | 欧美激情精品久久久久 | 范冰冰一级做a爰片久久毛片 | 日韩成人在线免费观看 | 久久中文字幕一区 | 黑人巨大精品 | 国产成人精品久久二区二区91 | 99视频网站| 日韩欧美中文在线 | 欧美在线亚洲 | 精品在线一区二区三区 | 欧美电影在线观看网站 | 国产精品免费大片 | 日日骚网 | 91在线一区 | 欧美一区二区三区的 | 天天看天天摸天天操 | 91看片免费 | 国产一区999| 中文字幕一区二区三区在线视频 | 中文字幕国产视频 | 久久精品国内 | 精品国产一区二区三区久久久四川 | 国产精品久久久久久av公交车 | 精品国产网 | 欧美在线观看网站 | 中文字幕av网 | 成人精品国产免费网站 | 不卡视频一区二区三区 | 国产精品1区2区3区 男女啪啪高潮无遮挡免费动态 | 成人免费视屏 | 国产美女黄色片 | 国产一级片网站 | 午夜性色a√在线视频观看9 | 97免费在线观看视频 | 日韩精品在线观看网站 | 久久国产精品一区二区 | 极品国产视频 | 一级做a爰片性色毛片16美国 | 一区二区三区四区不卡 | 久久久久成人精品 |