tto / docs / macos / ssh

Copy the public key to the profile’s .ssh/authorized_key file. It may be necessary to create the .ssh directory first.

ssh root@192.168.236.134 'mkdir /root/.ssh'
scp .ssh/id_rsa.pub root@192.168.236.134:/root/.ssh/authorized_keys

On macOS, use ssh-copy-id and specify the remote machine (note: user on remote machine must match local user on the mac)

ssh-copy-id myserver

Ubuntu (w/ encryption)

Ubuntu can be installed with encrypted home directories, in that case, sshd does not have access to the user’s authorized_keys file.

So, first create a global folder with the username

sudo mkdir /etc/ssh/tom

Then put an authorized_keys file into it, include the keys you want to authorize ;)

Update /etc/ssh/sshd_conf to include the following line:

AuthorizedKeysFile    /etc/ssh/%u/authorized_keys

Lastly restart the SSH Service

sudo service ssh restart

And you’re good to go!

Linux add user

To add a new admin account on a linux box use:

useradd -d /home/ttor -m ttor	
vi /etc/passwd	Set login shell (/bin/bash) p
passwd ttor	Set a password (used when ssh-copy-id)
vi /etc/sudoers 	Add the following line:
ttor ALL=(ALL) NOPASSWD: ALL	Enables "sudo su -"without password entry