Assuming you have an account named user
on a Unix-like system, such and monkey.lips, you can set up key-based authentication fairly easily. This method allows you to log in without entering a password:
Make sure you have SSH keys generated on your local machine. If you haven't done this yet, you can generate a new key pair with the following command and follow the prompts:
ssh-keygen -t ed25519
.ssh
DirectoryIf you don't already have a .ssh
directory in your home directory, create it:
mkdir -p ~/.ssh
Verify that the authorized_keys
file exists, and if not, create it:
touch ~/.ssh/authorized_keys
Verify that the .ssh
directory and authorised_keys
file have the correct permissions:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Copy your public key to the server using the ssh-copy-id
command. Replace user
with your username and monkey.lips
with the server address:
ssh-copy-id -i ~/.ssh/{your_key_name} user@monkey.lips
If you don't have ssh-copy-id
, you can manually copy the contents of your public key file
and paste it to the end of the authorized_keys
file on the server.
Use the following command, replacing user
and monkey.lips
with your username and server address:
ssh user@monkey.lips
If everything is set up correctly, you should be able to log in without entering a password.