On 10/7/24 6:31 AM, Carlos E. R. wrote:
On 2024-10-07 06:03, David C. Rankin wrote:
All,
Patrick was having issues with ssh/sftp in MC on TW so I was troubleshooting on my TW install.
The F1 "help" says mc will check ~/.ssh/known_hosts and use public/private keys. However, on first connection with mc, the password dialog is shown and a password is required. This doesn't fly if sshd/PasswordAuthentication is set to No to disable password auth.
So that you can compare, I tried on Leap 15.5.
I open sftp via menu right/sftp to another local machine. I simply enter
user@machine
and I enter with no password nor phrase, because at some point in the graphical session I have logged in with ssh, or maybe in another 'mc' with sftp, and the password agent remembers the passphrase.
In reverse direction it asks for my password.
Yes, this is my experience as well. You can test the mc-cli with cd sftp://user@host:port/path/to the [user@] and [:port] are optional, if needed. I've tried with the full string including :port to a box with ssh on a high-port and mc connects fine, but I have to include the :port as mc isn't checking ~/.ssh/config. The first time I'm presented with the pw dialog even though I have public/private key access to that box and I have to specify the port even though the Host/Port pair is set in ~/.ssh/config. So mc is working with ssh/sftp, but it isn't checking the ~/.ssh configuration file and isn't trying the public/private keys on first connection to the remote host. As with you, ssh-agent appears to provide the credential if I disconnect/reconnect within mc after the first connection. To me this looks like a bug. mc should use the Host/Port from ~/.ssh/config and it should try connecting with public/private keys just like ssh does. Maybe that's the issue, ssh does a full implementation of all the config and keys for its connection, but mc simply doesn't and just relies on ssh-agent to allow reconnect. Also strange since I've previously connected to all hosts in konsole before launching mc in a konsole session attached to the local machine. Will have to dig through the mc source to figure out whether it makes any attempt to use the config or keys on first connection or if those features simply are not implemented. -- David C. Rankin, J.D.,P.E.