LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-30-2023, 04:40 AM   #1
wonderlili
LQ Newbie
 
Registered: May 2023
Posts: 5

Rep: Reputation: 1
SSH : access denied after a few days (on 2 servers)


Hello
I have the same issue on 2 different debian 11 VSP (both hosted on different hosting service)

- First, I'm able to connect via SSH to the VSP (root or not root user)
- After a few days, without doing anything special (except I did install EvilGinx for a ethical hacking demo for a work event), when I try to login via SSH with the same user, I get an "access denied" message after I provided the password (I'm sure of the password), while it was working fine a few days ago.
- if I reboot the machine on rescue mode, using root user, I can connect via SSH but the SSH is still denied for my initial user that worked fine before

What can I do to prevent this from happening ?

Thanks

Last edited by wonderlili; 05-30-2023 at 04:45 AM. Reason: details
 
Old 05-30-2023, 07:27 AM   #2
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 709
Blog Entries: 1

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
I think more is needed then "access denied", I have never gotten just that message from Linux or a BSD. Try this to get more detail:

Code:
ssh -vvvv SERVER
 
Old 05-31-2023, 02:52 AM   #3
wonderlili
LQ Newbie
 
Registered: May 2023
Posts: 5

Original Poster
Rep: Reputation: 1
Thank you jmccue for your reply!

I did test with 2 users (root and debian user)

I get the same result (NON rescue mode):

Code:
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_rsa
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_rsa: No such file or directory
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_dsa
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_dsa: No such file or directory
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_ecdsa
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_ed25519
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_xmss
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
root@51.91.8.181's password:
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
root@51.91.8.181's password:



I was able to connect in RESCUE mode with the temporary password provided in this mode, and did change the debian user password to be 120% sure that this was not a password issue (like it can often be) but it looks like it's really not a password issue.



Also here is the sshd_config file : (the parts that are active)

Code:
PermitRootLogin yes
ChallengeResponseAuthentication no
UsePAM yes
AcceptEnv LANG LC_*
X11Forwarding yes
PrintMotd no

Later I did change the sshd_config file to test by adding those :

Code:
PubkeyAuthentication yes
PasswordAuthentication yes

But it seems like the changes are not persistant after a reboot in normal mode and quit the RESCUE mode... because they are commented again.

I guess there are multiple issues here due to my lack of knowledge but I did exhaust all resolution on my side using online documentation...
 
Old 05-31-2023, 09:35 AM   #4
Linux_Kidd
Member
 
Registered: Jan 2006
Location: USA
Posts: 737

Rep: Reputation: 78
it's linux?
no such identity: C:\\Users\\xx.Dupont/.ssh/id_ecdsa: No such file or directory


lets see command

which ssh

Last edited by Linux_Kidd; 05-31-2023 at 09:37 AM.
 
Old 05-31-2023, 10:31 AM   #5
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 709
Blog Entries: 1

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
Are you trying to connect to a Windows System from Linux ? That is what the log looks like to me.

I do not know how ssh works on Windows, but my guess ID "xx.Dupont" is not setup correctly on Windows or it does not exist. Or maybe a Windows version of sshd is not running.

If connecting to a Windows System I would suggest you ask in a Windows forum.

Last edited by jmccue; 05-31-2023 at 10:32 AM. Reason: spelling
 
Old 05-31-2023, 02:35 PM   #6
Linux_Kidd
Member
 
Registered: Jan 2006
Location: USA
Posts: 737

Rep: Reputation: 78
Quote:
Originally Posted by jmccue View Post
Are you trying to connect to a Windows System from Linux ? That is what the log looks like to me.

I do not know how ssh works on Windows, but my guess ID "xx.Dupont" is not setup correctly on Windows or it does not exist. Or maybe a Windows version of sshd is not running.

If connecting to a Windows System I would suggest you ask in a Windows forum.
I think it's sshd on 2 different debian 11 VSP (linux).
ssh client is TBD, perhaps that's on a windoze system?
 
Old 05-31-2023, 04:17 PM   #7
scottieH
Member
 
Registered: Mar 2021
Posts: 58

Rep: Reputation: Disabled
From ssh -vvv
Quote:
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_rsa
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_rsa: No such file or directory
It looks like you are SSH'ing into a windows machine because it is looking in C:\Users\xx.dupont (The users home directory). This is correct Windows path syntax. (The double backslash: Linux uses the backslash as a special character (escape) character. So to get an actual backslash, you need to use 'escaped backslash' or \\.)

Unix uses forward slashes for it's path name: /home/xx.Dupont

On your Ubuntu machine (the ssh client), you should have a file called /etc/ssh/ssh_config
This files specifies the location of the id_rsa files. The default is ~/.ssh/id_rsa (the ~ means "The users Home Directory")

Unix tries to ssh into Windows, the ~ gets replaced with the users home directory. In this case C:\Users\xx.Dupont, then appends /.ssh/ to the end of the path. It should append \.ssh\ to make a valid path.

Thus:
C:\\Users\\xx.Dupont/.ssh/id_rsa will never exist because Windows doesn't know what it is.
Your ssh -vvv command should show a file name like this:
C:\\Users\\xx.Dupont\\.ssh\\id_rsa

Try and cchange your ssh_config file (man -s 5 ssh_config) and see if that works.

If you have Unix _AND_ Windows machines, your problem gets a bit trickier, because Windows needs \\.ssh\\ and Unix needs /.ssh/
 
Old 06-01-2023, 02:21 AM   #8
wonderlili
LQ Newbie
 
Registered: May 2023
Posts: 5

Original Poster
Rep: Reputation: 1
Hello and thank you for your help

To be more precise : I'm connecting from my Windows machine to a Debian server, with the SSH command line.

I did change the ssh_config file as suggested (in rescue mode on the Debian server, and did attach the screenshot):

Click image for larger version

Name:	Screenshot SSH.png
Views:	22
Size:	60.7 KB
ID:	41134


I then did reboot the Debian server in normal mode.

Looks like the change did not take effect :

Code:
Microsoft Windows [Version 10.0.19044.2965]
(c) Microsoft Corporation. All rights reserved.

C:\Users\xx.Dupont>ssh -vvvv root@51.91.8.181
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname 51.91.8.181 is address
debug2: ssh_connect_direct
debug1: Connecting to 51.91.8.181 [51.91.8.181] port 22.
debug1: Connection established.
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_rsa error:2
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_rsa.pub error:2
debug1: identity file C:\\Users\\xx.Dupont/.ssh/id_rsa type -1
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_rsa-cert error:2
debug3: Failed to open file:C:/xx/xx.Dupont/.ssh/id_rsa-cert.pub error:2
debug1: identity file C:\\Users\\Elise.Dupont/.ssh/id_rsa-cert type -1
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_dsa error:2
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_dsa.pub error:2
debug1: identity file C:\\Users\\xx.Dupont/.ssh/id_dsa type -1
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_dsa-cert error:2
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_dsa-cert.pub error:2
debug1: identity file C:\\Users\\xx.Dupont/.ssh/id_dsa-cert type -1
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_ecdsa error:2
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_ecdsa.pub error:2
debug1: identity file C:\\Users\\xx.Dupont/.ssh/id_ecdsa type -1
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_ecdsa-cert error:2
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_ecdsa-cert.pub error:2
debug1: identity file C:\\Users\\xx.Dupont/.ssh/id_ecdsa-cert type -1
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_ed25519 error:2
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_ed25519.pub error:2
debug1: identity file C:\\Users\\xx.Dupont/.ssh/id_ed25519 type -1
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_ed25519-cert error:2
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_ed25519-cert.pub error:2
debug1: identity file C:\\Users\\xx.Dupont/.ssh/id_ed25519-cert type -1
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_xmss error:2
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_xmss.pub error:2
debug1: identity file C:\\Users\\xx.Dupont/.ssh/id_xmss type -1
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_xmss-cert error:2
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/id_xmss-cert.pub error:2
debug1: identity file C:\\Users\\xx.Dupont/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4p1 Debian-5+deb11u1
debug1: match: OpenSSH_8.4p1 Debian-5+deb11u1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 51.91.8.181:22 as 'root'
debug3: hostkeys_foreach: reading file "C:\\Users\\xx.Dupont/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file C:\\Users\\xx.Dupont/.ssh/known_hosts:3
debug3: load_hostkeys: loaded 1 keys from 51.91.8.181
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/known_hosts2 error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:xqPPaf6oZO4iXwxnfVznzMpfEta4l50W27U0xqJX338
debug3: hostkeys_foreach: reading file "C:\\Users\\xx.Dupont/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file C:\\Users\\xx.Dupont/.ssh/known_hosts:3
debug3: load_hostkeys: loaded 1 keys from 51.91.8.181
debug3: Failed to open file:C:/Users/xx.Dupont/.ssh/known_hosts2 error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug1: Host '51.91.8.181' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\xx.Dupont/.ssh/known_hosts:3
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug3: unable to connect to pipe \\\\.\\pipe\\openssh-ssh-agent, error: 2
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\xx.Dupont/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\xx.Dupont/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\xx.Dupont/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\xx.Dupont/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\xx.Dupont/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_rsa
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_rsa: No such file or directory
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_dsa
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_dsa: No such file or directory
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_ecdsa
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_ed25519
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: C:\\Users\\xx.Dupont/.ssh/id_xmss
debug3: no such identity: C:\\Users\\xx.Dupont/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
root@51.91.8.181's password:
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
root@51.91.8.181's password:

What did I miss, from your explanations ?

Thanks again
 
Old 06-11-2023, 11:38 PM   #9
elgrandeperro
Member
 
Registered: Apr 2021
Posts: 415
Blog Entries: 2

Rep: Reputation: Disabled
Looking at you logs, your system is missing /dev/tty. This is not unrelated to your password problem, the system always uses /dev/tty for the password input, its non existence will make logging in fruitless.


It should be somewhat like:

Code:
# ls -l /dev/tty
crw-rw-rw-. 1 root tty 5, 0 Apr 11 14:05 /dev/tty
 
Old 06-13-2023, 05:30 PM   #10
scottieH
Member
 
Registered: Mar 2021
Posts: 58

Rep: Reputation: Disabled
ssh keys & tty

Quote:
Failed to open file:C:/Users/xx.Dupont/.ssh/id_rsa.pub error:2
Looks like the SSH command is looking for C:/Users/xx.Dupont/.ssh/id_rsa.pub.

On Debian, C: will not exist. It will just be a full path.

If you are attempting to log in as the user named xx.Dupont, is the home directory actually /Users/xx.Dupont? The normal standard for Unix is to use /home for home directories (i.e. /home/xx.Dupont)

Here's what should happen:
Debian Side:

Quote:
User:xx.Dupont@Server:A$ ssh root@51.91.8.181
The ssh client shluld look in ~xx.Dupont/.ssh (where ~xx.Dupont is the home directory for xx.Dupont)
In the .ssh directory, it will look for public keys (.pub) files. Such as id_rsa.pub, id_dsa.pub id_ecdsa.pub, etc.
If the first file exists, and is readable, this key is sent to the server 51.91.8.181 and looks in ~root/.ssh/authorized_keys for that key. If it's there, the user xx.Dupont is granted access without prompting for a password.
If the first file does not exist, or is not readable, ssh skips to the next file.
This occurs until Either: A known key is found and the user is granted access, OR an alternate authentication method is used (such as a password).

Quote:
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
root@51.91.8.181's password:

Question: Do you have another debian machine to test ssh on (as described above)?
If not, log in to your debian machine as any user other than root, then try to "ssh to yourself"
(Don;t have another user? Create on! man useradd)
Quote:
User:MyName@Server:51.91.8.181$ ssh root@51.91.8.181
Does this work?
If not, ssh is not configured correctly on your debian machine -- fix that first.
You should be sure that MyUser can log in as root with a password, and then with ssh keys.
Note: Some machines are hardened so that you cannot ssh into the machine as root. It will ask you for a password, and not allow you to log in (probably without an error message).

You have another error message:
Quote:
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
The tty is what reads the keyboard entry. On Unix, C:/dev/tty will never exist. It will just be /dev/tty. Not sure where that is coming from (debian or windows), but it needs to be fixed. Even if you can successfully log in with ssh keys, you still need a tty (or pseudo-tty [pty]) to use the keyboard.

Windows Side:
The users home directory (On my windows machine, it is D:\Users\ScottieH) needs to have a .ssh directory. Permissions are important! Only the user should be able to access this directory.
If you want to use ssh keys for authentication, the .pub files go in this directory. Permissions matter! They need to be readable by more than just the user -- not sure what the permissions are on the windows side, you'll have to look that one up.

You should be able to login without ssh keys. Instead of trying to log in as root, try another debian user. (BTW: It is considered bad practice to log in as root, create another user for you. It can potentially save you heart-ache down the line.)

The error messages about Failed to open <filename>.pub aren't that important right now. If you want to use ssh keys for authentication, only 1 of those files needs to work. The bigger issue is the password also not working.

Note: The Windows user does not need to exist on the debian server -- the ssh key need only exist in ~<DebianUser>/.ssh/authorized_keys.
Ex:
My Windows UserID is ScottieH. My Linux userID is my employee number. I can still ssh from windows to Linux.
Quote:
ScottieH c:\> ssh MyEmployeeNumber@linuxMachine
If D:\users\scottieh\.ssh\id_<type>.pub exists -and- is readable -and-
exists in ~MyEmployeeNumber/.ssh/authorized_keys
then I can log in without a password.

Let us know what you find in your troubleshooting efforts.
 
Old 06-15-2023, 03:31 PM   #11
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,688
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
FYI: I'm not too familiar with the Windows side in this case, but I do know that the permissions of the .ssh folder are important: the folder must be accessible only to the current user. If they're wrong, ssh won't use it.
 
Old 06-16-2023, 01:40 AM   #12
wonderlili
LQ Newbie
 
Registered: May 2023
Posts: 5

Original Poster
Rep: Reputation: 1
Hello everybody

Thank you so much for your follow up on my problem.
As of now, it seems like I don't have this issue anymore on my new server. So I'll let the topic on the side for now, and hope this will help someone that encounter the same issues in the future.

Have a great week end
 
Old 06-16-2023, 01:40 PM   #13
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,688
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
As best you can, please try to "close this thread" by offering any final insights that you may now have. (For instance: "the Windows environment" might be less-familiar to those of us who lurk here ...)

Look carefully at "when you still perceived the problem" and then "when it seems to have gone away." Your successors will surely thank you.

Last edited by sundialsvcs; 06-16-2023 at 01:43 PM.
 
1 members found this post helpful.
Old 06-19-2023, 01:56 AM   #14
wonderlili
LQ Newbie
 
Registered: May 2023
Posts: 5

Original Poster
Rep: Reputation: 1
Well, I was not able to find actively a solution, unfortunately.

What I did realize is that I had this issue with the first VSPs (from an internet provider) and not with the next VSP (from another internet provider).
I was not able to solve the issue on the VSP that had this behavior.

I think the issue came from the fact that I had to do the SSH from my Windows machine to the Debian server. So in the end, I did put the Debian server on a local VM, on my Windows machine, to avoid having to do any SSH.
It's not a "solution", it's a workaround, but I had very few time to make it work, since I was preparing this for an event in my company. So I took the fastest workaround possible.
Not sure this will help any successors, but I again deeply thank you all for your help in this.
 
1 members found this post helpful.
Old 06-20-2023, 03:03 AM   #15
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,167

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
root can still login or SSH to Linux VM?

and Linux VM uses LDAP?

Last edited by JJJCR; 06-20-2023 at 03:03 AM. Reason: edit
 
  


Reply

Tags
ssh



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot log in after a few security changes ("Module is Unknown"/"Access Denied") dj_thrive Linux - Security 1 03-27-2017 10:51 AM
read-only access after a few days jacko1729 Linux - Networking 4 07-27-2005 08:52 AM
Networking stops working after a few days DC12k Linux - Networking 9 04-11-2005 10:21 PM
X freezes after a few days uptime slackaddict Slackware 12 03-01-2005 01:35 AM
eth0 goes down after a few days up CRego3D Linux - Hardware 6 03-27-2004 10:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration