git clone on Ubuntu 12

Apparently your keys get wiped everytime you log out? Resulting in:

Permission denied (publickey).

Follow step3 here to add it!

Also add this to your .bashrc to add it on start up.

# Add to your Bash config file
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
    trap "kill $SSH_AGENT_PID" 0

#auto add key
ssh-add ~/.ssh/id_rsa

Additional SFTP access

Add new user. This will create the following:
– a new directory at /home/newuser/
– user and group called newuser

$ sudo adduser newuser

Edit /etc/ssh/sshd_config

#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp

At the end of /etc/ssh/sshd_config

Match User newuser
  PasswordAuthentication yes

Restart SSH

$ sudo service ssh restart

Try and SFTP in.

To change new user’s password.

$ sudo passwd newSFTPuser


Generate SSH key

ssh key

Github saves the day

Key with passphrase

With password foobar.

openssl genrsa -aes128 -passout pass:foobar -out privkey.pem 2048
openssl rsa -in privkey.pem -passin pass:foobar -pubout -out

pem to ssh-rsa

chmod 600 privkey.pem
ssh-keygen -y -f privkey.pem >

Cert request

Server key without pass phrase or self assigned cert

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout myPrivateKey.key -out myCert.pem


openssl rsa -in ./myPrivateKey.key -out myPrivateKey_rsa
chmod 600 ./myPrivateKey_rsa

Public key

ssh-keygen -y -f myPrivateKey_rsa >

To convert to PPK, load myPrivateKey_rsa into PuttyGen and export myPrivateKey.ppk

openssl.conf NOT FOUND!
Windows doesn’t save your openssl.conf location.
You need to set it in environment variables.

set OPENSSL_CONF=C:\xampp\apache\conf\openssl.cnf

Cert request reference

RSA Key reference

Azure Reference