Skip to content

Instantly share code, notes, and snippets.

@nclundsten
Last active October 14, 2015 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nclundsten/ecf4f3609aa27f3218f6 to your computer and use it in GitHub Desktop.
Save nclundsten/ecf4f3609aa27f3218f6 to your computer and use it in GitHub Desktop.
add ssh key to ibm-i (or others)

ssh to the server to set everything up

ssh USERNAME@server.tld

set up home directory

mkdir /home/USERNAME

chown USERNAME /home/USERNAME

chmod 755 /home/USERNAME

set up ssh directory

mkdir /home/USERNAME/.ssh

chown USERNAME /home/USERNAME/.ssh

chmod 700 /home/USERNAME/.ssh

set up authorized_keys file

touch /home/USERNAME/.ssh/authorized_keys

chown USERNAME /home/USERNAME/.ssh/authorized_keys

chmod 600 /home/USERNAME/.ssh/authorized_keys

return to local machine

exit

create a new ssh keypair if needed (you can press enter at every prompt)

ssh-keygen -t rsa -b 4096 -C "Dell ubuntu dev laptop"

ssh-add

copy public ssh key to server (in home directory)

scp ~/.ssh/id_rsa.pub USERNAME@server.tld:/home/USERNAME/id_rsa.pub

ssh into server again

ssh USERNAME@server.tld

append your public key that was copied, to authorized_keys

cat id_rsa.pub >> /home/USERNAME/.ssh/authorized_keys

done, time to test

exit

ssh USERNAME@server.tld

(you should be logged in without being asked for password!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment