AWS SSH Tricks

Here some simple steps for creating an additional user and copying their public ssh key:

Download private key, secure file:
chmod 600 myPrivateKey.pem

Publish .pem private key to OSX keychain:
ssh-add -K myPrivateKey.pem

Copy publickey to server
scp myPublicKey.pub user@ip:~

Create user, move key to
sudo adduser [new user] sudo
sudo mv myPublicKey.pub /home/[new user]/

Switch to su [new user]
mkdir ~/.ssh
chmod 700 ~/.ssh
sudo cat myPublicKey.pub >> ~/.ssh/authorized_keys

If errors you may need to take ownership:
sudo chown -R [new user]:[new user] /home/[new user]/.ssh/authorized_keys

Check key and logon:
cat authorized_keys
ssh [~.amazonaws.com]

Secure files:
chmod 600 ~/.ssh/authorized_keys

Copy files and directorys to AWS server:
scp -r * [ip]:~/temp/

Also use this to add pub direct:
cat myPublicKey.pub | ssh user@[ip] “cat >> ~/.ssh/authorized_keys”

Reference:
https://help.ubuntu.com/community/SSH/OpenSSH/Keys
https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys–2
http://blogs.aws.amazon.com/security/post/Tx3N8GFK85UN1G6/Securely-connect-to-Linux-instances-running-in-a-private-Amazon-VPC

Upgrading Ubuntu to 14.04 “not enough free disk space” on ‘/boot’

While upgrading Ubuntu to 14.04 you receive the error “not enough free disk space” on ‘/boot’ you need at least 57m free.

Check your space:

fdisk -l &&df -h

List unused images:

dpkg -l | grep linux-image

The fix, this removes all unused kernels:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge

Check space, reboot and rerun upgrade:

fdisk -l &&df -h

References:
Ubuntu Cleanup: How to Remove All Unused Linux Kernel Headers
Can’t upgrade due to low disk space on /boot