ssh服務(wù)

telnet

遠(yuǎn)程登錄 協(xié)議,23/tcp
C/S
S:telnet服務(wù)器
C:Telnet客戶端
明文傳送

ssh

Secure Shell,應(yīng)用層協(xié)議 22/tcp
通信過(guò)程和認(rèn)證過(guò)程都是加密的。主機(jī)認(rèn)證
主機(jī)密鑰
非對(duì)稱加密
secrect key public key
第一次 ssh 傳送公鑰 yes/no
數(shù)據(jù)用對(duì)稱加密
客戶端建立連接后,生成對(duì)稱密鑰(服務(wù)器公鑰加密后傳送過(guò)去)--》傳送給服務(wù)器。
后面用對(duì)稱密鑰加密,可以提高加解密的速度。
不允許root用戶直接登錄,一般是su在切換。
不定期更改密碼。

  1. 通信過(guò)程及認(rèn)證過(guò)程是加密的,主機(jī)認(rèn)證
  2. 用戶認(rèn)證過(guò)程加密
  3. 數(shù)據(jù)傳輸過(guò)程加密

ssh V1 V2

V1 :man-in-middle中間人攻擊
sshv2

認(rèn)證過(guò)程:

用戶認(rèn)證過(guò)程加密(用戶與主機(jī)的密鑰)
客戶端:生成密鑰s/p ----> p(放在用戶的家目錄) 數(shù)據(jù)--s--P -->s--p--->服務(wù)器 (對(duì)稱加密)
1.基于口令認(rèn)證
2.基于密鑰的認(rèn)證

協(xié)議:規(guī)范
實(shí)現(xiàn):服務(wù)器端,客戶端

linux:openSSH
  C/S 
    服務(wù)器:sshd,配置文件/etc/ssh/sshd_config
    客戶端:ssh,配置文件/etc/ssh/ssh_config
    ssh-keygen:密鑰生成器
     ssh-keygen - authentication key generation, management and conversion
    ssh-copy-id:將公鑰傳輸至遠(yuǎn)程服務(wù)器。
           ssh-copy-id - install your public key in a remote machine’s authorized_keys
           ssh-copy-id [-i [identity_file]] [user@]machine
scp:跨主機(jī)安全復(fù)制工具。

客戶端:

       ssh  ip(和當(dāng)前主機(jī)一樣的用戶)
       ssh -l useranme host
       yes  (主機(jī)認(rèn)證)
       password:主機(jī)密碼
   ssh hadoop@ip(遠(yuǎn)程主機(jī)用戶)
   .ssh/known_host
   
ssh username@host 'command'
ssh youdi@172.16.0.30  'ls -a'
要輸入密碼:

scp:

   scp src dest 
    -R
     -a
   源,目的都可以是遠(yuǎn)程主機(jī)
scp username@host:/path/to/somefile /path/to/local

ssh-keygen:

  ssh-kengen -t rsa 
       ~/.ssh/id_rsa
       ~/.ssh/id_rsa.pub
公鑰復(fù)制(追加到)到遠(yuǎn)程主機(jī)某用戶家目錄下的:.ssh/authorized_keys文件或.ssh/authorized_keys2文件中
.ssh 目錄權(quán)限必須是700
ssh-copy-id
 ssh-copy-id [-i [identity_file]] [user@]machine
ssh-copy-id -i id_rsa.pub root@172.16.20.6
單項(xiàng)信任關(guān)系
ssh-keygen -t rsa
ssh-copy-id  -i filename username@host
scp  authorized_keys
ssh-kengen -t rsa -f .ssh/id_rsa -P ''
-f /path/to/key_file 
-P  指定加密私鑰的密碼


netstat 

dropbear

嵌入式系統(tǒng)專用的ssh服務(wù)器端和客戶端工具。
服務(wù)器:dropbear
dropbearkey
客戶端:dbclient

dropbear默認(rèn)使用nsswitch實(shí)現(xiàn)名稱解析:

/etc/nsswitch
/lib/libnss_files*
/usr/lib/libnss3.so
/usr/lib/libnss_files*


dropbear會(huì)在用戶登錄檢查其默認(rèn)的shell是否為當(dāng)前系統(tǒng)的安全shell
  /etc/shells
tty
  tty - print the file name of the terminal connected to standard input
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容