TLDRBins TLDRBins / SSH


Usage Tips:

  • Click on a keyword to enable inline editing.
  • Click inside a code block to copy (excludes comments).
  • Use the button to view examples.
  • Click outside to collapse all examples.

Check SSH version

openssh-server (ubuntu)

openssh-server (debian)

Config Location

/etc/ssh/sshd_config
Sample Output: TO-DO
# Grep contents grep -Ev "^#" /etc/ssh/sshd_config | grep .
Sample Output: TO-DO

Generate SSH Key

ssh-keygen
Sample Output: TO-DO
#Set filename, leave passphase blank ./id_rsa
Sample Output: TO-DO
#After Creation chmod 600 id_rsa
Sample Output: TO-DO

Check Public Key

ssh-keygen -l -f id_rsa
Sample Output: TO-DO

Generate no passphrase SSH key from encrypted key

openssl rsa -in id_rsa_encrypted -out ./id_rsa
Sample Output: TO-DO

Convert .ppk to .pem format

# Install sudo apt install putty-tools
Sample Output: TO-DO
# Convert to private key in pem format puttygen key.ppk -O private-openssh -o key.pem
Sample Output: TO-DO
# Convert to public key in pem format puttygen key.ppk -O public-openssh -o key.pem.pub
Sample Output: TO-DO

Add SSH Access to Target

cat id_rsa.pub
Sample Output: TO-DO
#Copy and Paste to Target echo <BASE64_PUB_KEY> >> /home/<USER>/.ssh/authorized_keys
Sample Output: TO-DO

SSH Connect

ssh <USER>@<TARGET>
Sample Output: TO-DO
# After first connection (i.e., after 'yes' to fingerprint prompt) sshpass -p '<PASSWORD>' ssh <USER>@<TARGET>
Sample Output: TO-DO
ssh <USER>@<TARGET> -i id_rsa
Sample Output: TO-DO
# Fix: no matching host key type found. Their offer: ssh-rsa,ssh-dss ssh <USER>@<TARGET> -i id_rsa -oHostKeyAlgorithms=+ssh-rsa
Sample Output: TO-DO
# Fix: sign_and_send_pubkey: no mutual signature supported ssh <USER>@<TARGET> -i id_rsa -o PubkeyAcceptedKeyTypes=ssh-rsa
Sample Output: TO-DO

Note: Always append a new line in id_rsa key

# Spawn target shell to escape restricted shell ssh <USER>@<TARGET> -t bash
Sample Output: TO-DO