Linux

scp 不支持 .ssh/config

  • October 13, 2015

在我的~/.ssh/config文件中使用了幾年arcfour作為 SSH2 連接的預設密碼

host namaka
   hostname localhost
   port 2022
   ciphers arcfour
   IdentityFile ~/.ssh/virtualbox
   compression true
   StrictHostKeyChecking no
   user kermit 

升級到 Debian 8 後,我發現此密碼已從預設 ssh 配置中禁用,我收到以下錯誤

no matching cipher found: client arcfour server aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com

所以我將我的*~/.ssh/config*更改為

host namaka
   hostname localhost
   port 2022
   ciphers aes256-ctr
   IdentityFile ~/.ssh/virtualbox
   compression true
   StrictHostKeyChecking no
   user kermit

(注意密碼 aes256)現在我的 ssh 連接又可以工作了。

kermit@euroforce:~$ ssh kermit@namaka

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Jul 16 00:20:21 2015 from 10.0.2.2
kermit@namaka:~$ 

不幸的是,當我嘗試執行 scp 時,我仍然收到不匹配的密碼錯誤

kermit@euroforce:~$ scp foo  kermit@namaka:/tmp/
no matching cipher found: client arcfour server aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
lost connection

似乎 scp 已將以前的密碼記憶體在某處,並且不想使用新密碼。

從命令行強制密碼確實有效

kermit@euroforce:~$ scp -c aes256-ctr foo  kermit@namaka:/tmp/foo2
foo                                                                 100%    0     0.0KB/s   00:00  

強製配置文件不起作用

kermit@euroforce:~$ scp -C .ssh/config foo  kermit@namaka:/tmp/foo2
no matching cipher found: client arcfour server aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
lost connection

有什麼線索嗎?

我找到了罪魁禍首:這是我幾年前創建的一個 bash 別名,然後忘記了

alias scp='scp -c arcfour'

為我感到羞恥

引用自:https://unix.stackexchange.com/questions/220257