Closed namespaceYcZ closed 1 year ago
Hi,
patterns like %h
are currently not supported in ssh2-config, so that won't work for sure atm.
The host syntax is not working, maybe there is an issue with comments after the host definition. I need to check if there is a bug in ssh2-config.
In case that won't work I'll may ask you to provide me with the debug log file generated by termscp.
It doesn't look like an issue with ssh2-config.
Could you try to run termscp with -D
option and provide me with the log file (obfuscated at your discretion)? The log file can be found at:
$HOME/.config/termscp/termscp.log on Linux/BSD
$HOME/Library/Application Support/termscp/termscp.log on MacOs
FOLDERID_RoamingAppData\termscp\termscp.log on Windows
It doesn't look like an issue with ssh2-config.
Could you try to run termscp with
-D
option and provide me with the log file (obfuscated at your discretion)? The log file can be found at:$HOME/.config/termscp/termscp.log on Linux/BSD $HOME/Library/Application Support/termscp/termscp.log on MacOs FOLDERID_RoamingAppData\termscp\termscp.log on Windows
I changed my virtual machines and ssh config to the following for convenience:
ssh to test-ubuntu:
then run termscp with -D
option:
then I found something wrong in the log file: termscp tried to connect to the
test-ubuntu
with my Windows username, not the cross
specified in the ssh config file:
termscp log created by
termscp -D test-ubuntu
so I tried again with username like this:
termscp used
cross
correctly this time, but still failed with an unknown error:
termscp log created by
termscp -D cross@test-ubuntu
It looks like the ssh config resolves correctly and RSA key is actually found, but for some reason, the ssh crate reports an unknown error when authenticating. A last try could be to insert the private ssh key in the termscp key storage (CTRL+C, ssh keys) and see if anything changes, but I don't think so.
I'll investigate on some issues with RSA auth with ssh crate.
It looks like the ssh config resolves correctly and RSA key is actually found, but for some reason, the ssh crate reports an unknown error when authenticating. A last try could be to insert the private ssh key in the termscp key storage (CTRL+C, ssh keys) and see if anything changes, but I don't think so.
I'll investigate on some issues with RSA auth with ssh crate.
I tried to insert the private ssh key (from id_rsa
in my ~/.ssh/
directory) in the termscp key storage, but failed.
(
Ctrl+N
in SSH keys
tabhx
ssh key is empty
)
But ... termscp did create a ssh key file named cross@192.168.0.106.key
in %appdata%/termscp/.ssh
.
So I tried termscp -D cross@192.168.0.106
... and failed again:
termscp.log
I don't know hx as editor, maybe it's running on another thread after start. I'd say try with nano or vim
I don't know hx as editor, maybe it's running on another thread after start. I'd say try with nano or vim
I tried again and this problem just disappeared. Both hx
and nvim
work.
I don't know why but ... just let's forget this little interlude.
I installed termscp on my ubuntu virtual machine and tried to connect to other linux virtual machine.
I failed again and found a new problem:
(I need the
PubkeyAcceptedKeyTypes
field to bypass the restriction of the new version of the ssh client)
termscp.log
Can you try temporarily to remove that field to see whether termscp works? Unfortunately, that field will be parsed correctly only in the 0.11.1 version.
Can you try temporarily to remove that field to see whether termscp works? Unfortunately, that field will be parsed correctly only in the 0.11.1 version.
I tried again.
The good news is that termscp can connect to my test server with specified username(termscp testuser@prod-rhel
).
The bad news is that termscp fails to connect to the remote server without a specified username if the local username is not the same as the remote username. It seems that termscp ignores the User
field in the ssh config file and uses local username.
Video_2023-03-04_092744.webm tscp-failed.log tscp-success.log
(Termscp logs in Windows are here. I think this problem may be Windows-specific. )
I tried again. The good news is that termscp can connect to my test server with specified username(
termscp testuser@prod-rhel
). The bad news is that termscp fails to connect to the remote server without a specified username if the local username is not the same as the remote username. It seems that termscp ignores theUser
field in the ssh config file and uses local username.
I have a couple of suggestions, although I don't know if they are appropriate. The first is to not show the Password:
prompt when logging in successfully with the ssh key, just like the ssh tool does. Another is to put the termscp.log
file in the cache directory instead of the config directory (if the project uses dirs
crate, dirs::cache_dir()
can be used , the cache directory is ~/.cache
on Linux and ~\AppData\Local
on Windows)
I fixed in 0.12 the issue with the username not being taken from the ssh config.
Hi, i just wanna say i'm still having this error with ssh config, even if i put the key into the key storage
2023-05-17T16:47:10.5847296Z [DEBUG] (1) remotefs_ssh::ssh::sftp: Initializing SFTP connection...
2023-05-17T16:47:10.5851739Z [TRACE] (1) remotefs_ssh::ssh::config: [C:\Users\chris\.cargo\registry\src\github.com-1ecc6299db9ec823\remotefs-ssh-0.2.0\src\ssh\config.rs:69] Parsing configuration at C:\Users\elect/.ssh/config
2023-05-17T16:47:10.5858239Z [DEBUG] (1) remotefs_ssh::ssh::commons: Connecting to 'host:22'
2023-05-17T16:47:10.5860396Z [TRACE] (1) remotefs_ssh::ssh::commons: [C:\Users\chris\.cargo\registry\src\github.com-1ecc6299db9ec823\remotefs-ssh-0.2.0\src\ssh\commons.rs:59] Trying to connect to socket address 'host:22' (timeout: 30s)
2023-05-17T16:47:10.6678685Z [DEBUG] (1) remotefs_ssh::ssh::commons: Connection established with address host:22
2023-05-17T16:47:10.6681453Z [TRACE] (1) remotefs_ssh::ssh::commons: [C:\Users\chris\.cargo\registry\src\github.com-1ecc6299db9ec823\remotefs-ssh-0.2.0\src\ssh\commons.rs:136] Configuring algorithm preferences...
2023-05-17T16:47:10.6682625Z [TRACE] (1) remotefs_ssh::ssh::commons: [C:\Users\chris\.cargo\registry\src\github.com-1ecc6299db9ec823\remotefs-ssh-0.2.0\src\ssh\commons.rs:138] compression: true
2023-05-17T16:47:11.2726594Z [DEBUG] (1) remotefs_ssh::ssh::commons: Authenticating with username 'root' and RSA key
2023-05-17T16:47:11.2727606Z [TRACE] (1) remotefs_ssh::ssh::commons: [C:\Users\chris\.cargo\registry\src\github.com-1ecc6299db9ec823\remotefs-ssh-0.2.0\src\ssh\commons.rs:209] Trying to authenticate with RSA key at 'C:\Users\elect\AppData\Roaming\termscp/.ssh/root@oracle.key'
2023-05-17T16:47:11.2730528Z [ERROR] Authentication failed: [Session(-1)] unknown error
2023-05-17T16:47:11.2732057Z [TRACE] (1) remotefs_ssh::ssh::commons: [C:\Users\chris\.cargo\registry\src\github.com-1ecc6299db9ec823\remotefs-ssh-0.2.0\src\ssh\commons.rs:209] Trying to authenticate with RSA key at 'C:\Users\elect/.ssh/id_rsa'
2023-05-17T16:47:11.2734354Z [ERROR] Authentication failed: [Session(-1)] unknown error
Some basic background info: I have some Linux virtual machines, for some reason they need to use dhcp and their ip addresses change often. I wrote a script to detect their ip addresses (using![2023-02-23_203855](https://user-images.githubusercontent.com/3965259/220912586-0fd1304e-2c7f-4460-911e-934e67c32b09.jpg)
arp
util) and write to the hosts file of the host machine, so that I don't have to change my ssh config or any other config file that use the services on those virtual machines.I can always log in to these virtual machines with a fixed ssh command just like this(
(because I have set up my ssh config and added my public key to the authorized_keys file so I do not have to offer my password)
![2023-02-23_201702](https://user-images.githubusercontent.com/3965259/220913615-dc037bcc-0315-43e0-a29b-35074046f0e5.jpg)
ssh cross-platform
where "cross-platform" is the hostname in the ssh config file):(I can always ssh to it after using the script to detect its IP address even if the IP address of this virtual machine changes). Now, how can I use termscp to connect to the remote server using ssh config? (I have check the config of termscp's default config, which is ok:
)
(I have also replaced the
%h
in the ssh config with real IP, which did not work either.)All these approaches failed, so ... what is the correct way?
Environment