Temporarily disable ssh public key authentication from client

Solution 1:

If you want to bypass key authentication when logging to the server, just run:

ssh -o PubkeyAuthentication=no user@host

Solution 2:

This sounds like a configuration issue on the server side.

If the server allows both public key and password authentication then even if you try to connect without a private key file present on the client, it should prompt you for a password.

If you are getting the error message "Permission denied (publickey)" then it sounds like password authentication is not supported on your server.

Without seeing the /etc/sshd_config file, it is difficult to know but my guess would be that you need to make sure the following line exists:

PasswordAuthentication yes

Restart the ssh server, and when you connect from the client you should be prompted for a password if there is no private key present, or if the private key doesn't match the public key on the server.

A more secure alternative to this of course would be to copy your private key to the laptop which you are using, or in-fact generate a new private key to be used on that laptop and add the public key to .ssh/authorized_keys


Solution 3:

Just make an ID file that is blank.

touch $HOME/.ssh/blank

If you leave the permission 640 or 644 then ssh will complain that the permissions are not secure enough and not use it. If you chmod it to 600, then it will prompt for a password 3 times and fail because there is no password. So just leave it 640 or 644.

Then when you ssh use this command.

ssh -i $HOME/.ssh/blank servername-or-ip

You could use .ssh/config and set a host entry to not use the key but it is less temporary or you could create aliases for server and server-nokey but it gets long and is a pain to maintain.

Tags:

Ssh

Ssh Keys