Skip to content

ssh 22

Target host’s fingerprint

Adding (whitelisting) the target host’s fingerprint

ssh-keyscan -t rsa $ip >> ~/.ssh/known_hosts

Run commands remotely

ssh root@$ip "id"

Set up ssh

Public-private key pairs are located in the ~/.ssh/ directory

ssh-keygen -t rsa

ssh configuration file etc/ssh/sshd_conf

ssh-copy-id command will read the public key from ~/.ssh/id_rsa.pub and adds it to ~/.ssh/authorized_keys on the targetserver

ssh-copy-id -i ~/.ssh/id_rsa.pub user@targetserver

Using ssh

chmod 600 id_rsa
ssh -i id_rsa root@$ip
sshpass pass ssh root@$ip