SSH Auto Login - How to automatically log into your server

Опубликовано: 21 Август 2026
на канале: D;
4,196
23

http://www.damnsemicolon.com for the full post details.

1. Log into your server via SSH
:~ ssh [email protected]

2. Create a new RSA key
:~ ssh-keygen -t rsa
Hit return twice unless you want to set a password on the key.

3. Go to your .ssh folder
:~ cd .ssh

4. Put the public key into your authorized_keys file
:~ cat id_rsa.pub (double greater than signs) authorized_keys

5. Set perms on authorized_keys
:~ chmod 600 authorized_keys

6. Remove the public key
:~ rm id_rsa.pub

7. Close your SSH connection and go back to your local computer

8. Go to our .ssh directory
:~ cd .ssh

9. Secure file transfer the private key to our .ssh folder
:~ scp [email protected]:~/.ssh/id_rsa ./

10. Create a folder for the key - Note: named it something related to the domain
:~ mkdir folder_name

11. Move the private key into the folder
:~ mv id_rsa folder_name

12. Open up the SSH config in your fav editor
:~ sudo pico config

13. Enter the following details:
Host alias_name
Hostname domain.com
User username
PreferredAuthentication publickey
IdentifyFile ~/.ssh/folder_name/id_rsa

14. Save and close the file

15. Connect to your server with your alias
:~ ssh alias_name

It should now log you in without any authentication.