enable ssh session using keys instead of password in dokku


We have a Dokku server installation. You can run remote commands to ease up a little bit the administration tasks.
So, to avoid the need to logon the server and run some dokku commands I needed to configure ssh keys.
First, let’s create our keys -if you haven’t yet-

ssh-keygen -t rsa

let’s copy our public key to the clipboard.

cat ~/.ssh/id_rsa.pub | xclip -selection clipboard

you can add the second command to an alias in the file ~/.bash_aliases if you wish

alias cb=’xclip -selection clipboard’

so the previous command would be

cat ~/.ssh/id_rsa.pub | cb

then we can paste our public key to the authorized clients on the server

ssh joe@dokku.me
sudo su
cd /home/dokku/.ssh
cat >> authorized_keys
press CTRL-C

you must prepend your public key (your key starts with the type, ssh-rsa in this case) in the authorized_keys file with the following configuration (this should have been done when installing dokku)

command=”FINGERPRINT=SHA256:qriqw51R00ha3WHe5Zo987APhwxolya3Sv5Dvwm/fqE NAME=\”admin1\” `cat /home/dokku/.sshcommand` $SSH_ORIGINAL_COMMAND”,no-agent-forwarding,no-user-rc,no-X11-forwarding,no-port-forwarding ssh-rsa AAAAB3Nza…


now you can exit the server and run a remote command from your machine

ssh -t dokku@dokku.me apps:list



Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s