Ubuntu 18 (I think).
I was being able to login to a machine via SSH using my public key. Later I edited "/etc/ssh/sshd_config" so I could give password access to a third-party user I just created. I changed:
PasswordAuthentication no
Into:
PasswordAuthentication yes
AuthenticationMethods publickey,password
I thought this would allow me to use the publickey as default authentication method (so I could still log in as usually), else being prompted for a password (for the new user).
But it turns that it's now asking for BOTH things: publickey and password. I don't know the password, as I was granted access using the public key, so I can't access the website anymore. Additionally, the third party user can't access either, as no public key was configured for him.
How could I re-gain access again??? I've asked the original sysadmin, but doesn't seem able to help. Shouldn't this sysadmin be able to login the machine using the original root password created when he first setup the machine??? (with the main objective or resetting or fixing "/etc/ssh/sshd_config", then restarting the SSH server)
AuthenticationMethods
and it should default to the remaining items in the system - password authentication and pubkey auth if enabled with PasswordAuthentication and PubkeyAuthentication both set to 'yes'. Only set "AuthenticationMethods" if you have multiple methods that have to succeed.sudo
should never be password-less on servers. Especially production machines. Not knowing your own user's password is never a good option. Eitherway, if you don't have physical access to the machine, hosting providers usually always give a recovery option for things like this. You might need to look there.AuthenticationMethods
.