
Subsequent connections will succeed without a password, since the SSH service will then be able to read my authorized_keys file in my decrypted home directory. Therefore, my first connection attempt will require a password. However, my authorized_keys file is stored in my home directory.
#Ssh copy id ssh password
Still, I kept getting prompted for a password upon login from my laptop.Īfter a few minutes on StackOverflow, I learned about Encrypted Home Directories, which are default in some environments, including Ubuntu.Įncrypted home directories aren’t decrypted until the initial login is successful. I made sure that the following options were enabled in /etc/ssh/sshd_config: PubkeyAuthentication yes and AuthorizedKeysFile.I made sure that the file was read-write only for myself and none others.

I checked my authorized_keys file over on the VPS to make sure my public key had been copied over correctly.ssh/ubuntu I kept getting prompted for a password. It should have let me through without requiring a password: When all was done, I attempted to login to my VPS. ssh/ubuntu I expected, the utility asked for my VPS password in order to complete the public key transfer. I then used the ssh-copy-id utility to copy my public key over to the authorized_keys file on my Vultr VPS: ssh-copy-id -i.I generated a new SSH keypair (named “ubuntu”) on my Mac using the command: ssh-keygen -t rsa -b 4096.

To set up key-based authentication from my laptop to the server, I’m partial to CentOS myself, but the task I was working on recommended Ubuntu. I recently provisioned a Ubuntu virtual private server (VPS) on Vultr.

By Arit Amana What to do when key-based authentication isn’t working after ssh-copy-id
