+1-323-999-6135 blog@hegars.com

GENERATE NEW KEY PAIR

This creates two files, A Private key (id_rsa) and Public Key (id_rsa.pub), back both up and keep secure

$ ssh-keygen -t rsa -C “hegars@hegars.com”

 

ENABLE ACCESS TO EXISTING SERVER

Create New User

Create a user on the server

# adduser hegars

Add User to Group

Add the newly created user to the required groups.

# usermod -a -G www-data,sudo hegars

Generate Temporary keys

This generated the set of temporary keys that is needed to kick something over in the OS to get it working, just remove the self generated keys

# su – hegars

$ ssh-keygen

Delete temp keys

Just delete the generated keys.

cd ~/.ssh/

rm *

Copy existing Public Key to User

$ cd ~/.ssh/

scp something from somewhere

$ cp id_rsa.pub authorized_keys

or paste it

$ vim authorized_keys

$ chmod 744 authorized_keys

Generate Public Key from Private Key

ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub