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
cat >> authorized_keys
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 firstname.lastname@example.org apps:list