I want to be able to login to a remote via ssh without having to enter the password all the time.
- How do I set it up?
- Is a different command required to execute a password-less session?
authenticationssh
I want to be able to login to a remote via ssh without having to enter the password all the time.
Best Answer
Answer
Execute this commands:
Then you'll need to copy the new key to your server:
After the key is copied, ssh into the machine as normal:
You can now login without entering a password from the particular machine you executed the commands at.
Example
Explanation
This assumes you already can successfully connect to your server via SSH.
You'll need to generate an SSH Keypair which will allow you to identify you as yourself without using a password. You can opt to protect keys with a passcode if you wish, but this can be left blank allowing totally password-less SSH access.
ssh-keygen
this will create anid_rsa
andid_rsa.pub
file. Thepub
file is what goes on the servers, the private key (id_rsa
) is what stays with you and is how you identify yourself.ssh-copy-id user@server
replacing user with your remote user and server with the machine DNS name or IP address. It'll prompt for your SSH password, enter it and if all completes successfully you'll be able to access the machine viassh user@server
without needing a password.References