Проблеми

На LinuxLite отримував помилку:

ssh olex@192.168.0.123
Unable to negotiate with 192.168.0.123 port 22: no matching key exchange method found.
Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,
diffie-hellman-group1-sha1

Знайшов рішення тут: https://unix.stackexchange.com/questions/402746/ssh-unable-to-negotiate-no-matching-key-exchange-method-found

Host wdisk
    Hostname 192.168.0.123
    Ciphers 3des-cbc
    KexAlgorithms +diffie-hellman-group1-sha1
    User olex

Рішення "Unable to negotiate..."

This particular error happens while the encrypted channel is being set up. If your system and the remote system don't share at least one cipher, there is no cipher to agree on and no encrypted channel is possible. Usually SSH servers will offer a small handful of different ciphers in order to cater to different clients; I'm not sure why your server would be configured to only allow 3DES-CBC.

Now, 3DES-CBC isn't terrible. It's slow, and it provides less security than some other algorithms, but it's not immediately breakable as long as the keys are selected properly. CBC itself has some issues when ciphertext can be modified in transit, but I strongly suspect that the resultant corruption would be rejected by SSH's HMAC, reducing impact. Bottom line, there are worse choices than 3DES-CBC, and there are better ones. However, always tread carefully when overriding security-related defaults, including cipher and key exchange algorithm choices. Those defaults are the defaults for a reason; some pretty smart people spent some brain power considering the options and determined that what was chosen as the defaults provide the best overall security versus performance trade-off.

As you found out, you can use -c ... (or -oCiphers=...) to specify which cipher to offer from the client side. In this case adding -c 3des-cbc allows only 3DES-CBC from the client. Since this matches a cipher that the server offers, an encrypted channel can be established and the connection proceeds to the authentication phase.

You can also add this to your personal ~/.ssh/config. To avoid making a global change to solve a local problem, you can put it in a Host stanza. For example, if your SSH config currently says (dummy example):

Port 9922

specifying a global default port of 9922 instead of the default 22, you can add a host stanza for the host that needs special configuration, and a global host stanza for the default case. That would become something like...

Host 10.255.252.1
    Ciphers 3des-cbc
    KexAlgorithms +diffie-hellman-group1-sha1
Host *
    Port 9922

The indentation is optional, but I find it greatly enhances readability. Blank lines and lines starting with # are ignored.

If you always (or mostly) log in as the same user on that system, you can also specify that username:

Host 10.255.252.1
    Ciphers 3des-cbc
    KexAlgorithms +diffie-hellman-group1-sha1
    User enduser
Host *
    Port 9922

You don't need to add a Host * stanza if there was nothing in your ~/.ssh/config to begin with, as in that case only compiled-in or system-wide defaults (typically from /etc/ssh/ssh_config) would be used.

At this point, the ssh command line to connect to this host reduces to simply

$ ssh 10.255.252.1

and all other users on your system, and connections to all other hosts from your system, are unaffected by the changes.

Debian

===== Debian - Для более-менее удобной работы =====

установить ''sshfs''

создаю каталог ''/home/ans/wdisk''

для доступа по SSHFS:

  sshfs ans@192.168.0.111:/DataVolume /home/ans/wdisk -p 22 -C -o follow_symlinks -o sshfs_sync -o workaround=rename

но в Debian при попытке подключения получаю:

  fuse: failed to open /dev/fuse: Permission denied

//For some reason, Debian configures FUSE to require users to be in the fuse group.

Run ''gpasswd -a username fuse'' as root, then log out and log in again. (Important step.)//

т.е., запускаю:

  sudo gpasswd -a ans fuse

Перезагружаюсь

и снова:

  sshfs ans@192.168.0.111:/DataVolume /home/ans/wdisk -p 22 -C -o follow_symlinks -o sshfs_sync -o workaround=rename

//The authenticity of host '192.168.0.111 (192.168.0.111)' can't be established.\\
RSA key fingerprint is 03:f7:b4:1d:32:33:09:d3:d3:7e:9d:c8:47:f3:01:e9.\\
Are you sure you want to continue connecting (yes/no)? yes\\
ans@192.168.0.111's password: //

и ввести пароль FTP/SSH юзера, который настраивается через web-интерфейс WDisk'а

----

или bash:

<code>
#!/bin/sh

sshfs ans@192.168.0.111:/DataVolume /home/ans/mnt/wdisk -p 22 -C -o follow_symlinks -o sshfs_sync -o workaround=rename
echo "WDisk mounted!"
# что-то старое
#echo "ssh ans.mail-ua -p 22..."
#ssh ans@192.168.0.111 -p 22
</code>

Last updated