Skip to content

Instantly share code, notes, and snippets.

@devthue
Created March 10, 2017 03:23
Show Gist options
  • Save devthue/de6f42ba7373d30497e02fb2d253ec23 to your computer and use it in GitHub Desktop.
Save devthue/de6f42ba7373d30497e02fb2d253ec23 to your computer and use it in GitHub Desktop.
Add SSH to server
Macbook-2:~ mac$ cd .ssh
Macbook-2:.ssh mac$ ls
id_rsa		id_rsa.pub	known_hosts
Macbook-2:.ssh mac$ scp id_rsa.pub root@o.test:./id_rsa.pub
root@o.test's password:
id_rsa.pub                                                                                                                                                              100%  406     6.6KB/s   00:00
Macbook-2:.ssh mac$ ssh root@o.test
root@o.test's password:
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.9.7-x86_64-linode80 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
Last login: Fri Mar 10 03:18:07 2017 from 14.169.35.154
root@jenkins-node:~# ls
id_rsa.pub
root@jenkins-node:~# ls
id_rsa.pub
root@jenkins-node:~# rm -rf .ssh
root@jenkins-node:~# mkdir .ssh
root@jenkins-node:~# chmod 700 .ssh
root@jenkins-node:~# cd .ssh
root@jenkins-node:~/.ssh# touch authorized_keys
root@jenkins-node:~/.ssh# chmod 600 authorized_keys
root@jenkins-node:~/.ssh# cat ../id_rsa.pub >> authorized_keys
root@jenkins-node:~/.ssh# rm ../id_rsa.pub
root@jenkins-node:~/.ssh#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment