# Generate 2 files, .key private key, .pub public key
USER=root
ssh-keygen -t rsa -b 2048 -f $USER.key
mv $USER.key.pub $USER.pub
# Provide no passphrase if used by a script

# Once a key is generated, the public part can be added to the authorized_keys of the remote host
# The private part remains secret
# ON REMOTE HOST
cd /home/$USER
if [ ! -d .ssh ]; then mkdir .ssh ; chmod 700 .ssh ; fi
mv $USER.pub .ssh/
cd .ssh/
if [ ! -f authorized_keys ]; then touch authorized_keys ; chmod 600 authorized_keys ; fi
cat $USER.pub >> authorized_keys
rm $USER.pub

# Optionnally, convert the .key file to .ppk to be used be putty, with puttygen
# File > Load key (.key) then Save private key
