SSH Cheat-sheet

SSH Cheat-sheet

This post will be kinda a notepad for different useful SSH tips and tricks

This post will be kinda a notepad for different useful SSH tips and tricks.

Organize access to multiple hosts with RSA/DSA keys

If, on example, you have multiple private keys that is used to connect to multiple servers via SSH, instead of using construction like

ssh -i <key_file>

you can simply create configuration file .ssh/config and organize all connections and use them after in a more simplified way:

Host short_host_name
    IndentityFile ~/.ssh/host_domain_com_rsa
    User remote_username

Host another_short_name
    IdentityFile ~/.ssh/dummy_sample_net_dsa
    User dummy_user

Connections can be simply established as ssh short_host_name and that's all!

Convert .ppk key to OpenSSH key format in Linux

If you have .ppk private key generated on Windows with puttygen and you need to get private key that can be used under Linux then follow these steps:

  1. Install PuTTY tools
    • Ubuntu: sudo apt install putty-tools
    • Debian: apt-get install putty-tools
    • RPM based: yum install putty
    • Gentoo: emerge putty
    • Archlinux: sudo pacman -S putty
  2. To generate private key:
puttygen id_dsa.ppk -O private-openssh -o id_dsa

To generate public key:

puttygen id_dsa.ppk -O public-openssh -o

Move these keys to ~/.ssh and set correct permissions:

mkdir -p ~/.ssh
mv -i ~/id_dsa* ~/.ssh
chmod 600 ~/.ssh/id_dsa
chmod 666 ~/.ssh/

Share Tweet Send

Related Articles

You've successfully subscribed to Prox blog
Great! Next, complete checkout for full access to Prox blog
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.