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 [email protected]:~

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

Switch to su [new user]
mkdir ~/.ssh
chmod 700 ~/.ssh
sudo cat >> ~/.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 []

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 | ssh [email protected][ip] “cat >> ~/.ssh/authorized_keys”


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

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