14 lines
1.1 KiB
Markdown
14 lines
1.1 KiB
Markdown
*Purpose*: Sometimes you need two linux computers to be able to talk to eachother without requiring a password. Passwordless SSH can be achieved by running the following commands:
|
|
|
|
!!! note "Non-Root Key Storage Considerations"
|
|
When you generate SSH keys, they will be stored in a specific user's profile, the one currently executing the commands. If you want to have passwordless SSH, you would run the commands from a non-root user (e.g. `nicole`).
|
|
|
|
``` sh
|
|
ssh-keygen # (1)
|
|
ssh-copy-id -i /home/nicole/.ssh/id_rsa.pub nicole@192.168.3.18 # (2)
|
|
ssh -i /home/nicole/.ssh/id_rsa nicole@192.168.3.18 # (3)
|
|
```
|
|
|
|
1. Just leave all of the default options and do not put a password on the SSH key. )
|
|
2. Change the directories to account for your given username, and change the destination to the user@IP corresponding to the remote server. You will be prompted to enter the password once to store the SSH public key on the remote computer.
|
|
3. This command is to validate that everything worked. If the remote user is the same as the local user (e.g. `nicole`) then you dont need to add the `-i /home/nicole/.ssh/id_rsa` section to the SSH command. |