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
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
# Connect to a domain-joined machine
ssh -l <USER>@<DOMAIN> <TARGET_DOMAIN>
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
SFTP Connect
sftp <USER>@<TARGET>
Sample Output:
TO-DO
# After first connection (i.e., after 'yes' to fingerprint prompt)
sshpass -p '<PASSWORD>' sftp <USER>@<TARGET>
Sample Output:
TO-DO