0

I am trying to follow this answer to login to my server via ssh without typing my extremely long password each time: https://serverfault.com/a/241593/295203

Right now I have 6 keys in my authorized_keys:

(base) -bash-4.1$ wc -l ~/.ssh/authorized_keys
6 /home/[myusername]/.ssh/authorized_keys

First instinct was to delete all of the keys in there and then do the ssh-copy-id id@server step of the above link out. However, I'm afraid of getting locked out completely if I do that.

My end goal:

  1. From my work computer where I ran ssh-keygen -t rsa -b 2048, to be able to login in to the remote server without using a password.
  2. From any other computer, require a password.

2 Answers 2

0

I would:

  1. make a backup of your ~/.ssh/authorized_keys while connected to the server
  2. open my ~/.ssh/authorized_keys file in a terminal text editor (nano/vi/...)
  3. by looking at the lines, identify the pub key of your work computer
  4. delete all other lines, save
  5. attempt a ssh connection from another terminal while still connected to make sure.
  6. if fails, restore backup and retry this till it succeeds.
0

It isn't clear to me if you're referring to either to passphrase's key or to the account's password, so I'm assuming you're referring to the account's password.

First, you can remove your key's passphrase by executing the command below, in a way you can log in to your server using a keypair without typing a passphrase (just hit enter when asked for a passphrase):

$ ssh-keygen -p -f ~/.ssh/id_rsa

Second, you can log in from any other computer just using your account's password, without passing a private key.

Nevertheless, I don't think you should do it if it's a publicly exposed server. Best Practices for server hardening says to not use passwords for login.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.