SSH

SSH, and Solutions.

Permission denied (publickey)

:

:SSH,,

Solutions:

  1. : ssh user@host 'cat ~/.ssh/authorized_keys'
  2. : chmod 600 ~/.ssh/id_ed25519( 600)
  3. .ssh : chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys
  4. : ssh -i ~/.ssh/correct_key user@host
  5. -v : ssh -v user@host, Offering public key
  6. : PubkeyAuthentication yes( /etc/ssh/sshd_config)

: ssh-copy-id and, ~/.ssh/config Host IdentityFile

ssh: connect to host xxx port 22: Connection refused

:

:SSH,

Solutions:

  1. SSH : systemctl status sshd service ssh status
  2. SSH : sudo systemctl start sshd
  3. SSH : ss -tlnp | grep ssh, ssh -p
  4. : sudo ufw status sudo iptables -L -n | grep 22
  5. : sudo ufw allow 22/tcp sudo firewall-cmd --add-port=22/tcp --permanent
  6. , / ACL SSH

: SSH (systemctl enable sshd), SSH

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! ... Host key verification failed.

:

:known_hosts, IP,

Solutions:

  1. /, : ssh-keygen -R hostname
  2. New, New : ssh user@host
  3. IP (New),
  4. , Contact
  5. known_hosts : vim ~/.ssh/known_hosts, IP

:. ssh-keyscan New. StrictHostKeyChecking=no,

ssh: connect to host xxx port 22: Connection timed out

:

:, (DROP REJECT),

Solutions:

  1. : ping host
  2. : telnet host 22 nc -zv host 22
  3. , VPN
  4. traceroute host
  5. , IP SSH

: ~/.ssh/config ConnectTimeout 10 and more. ServerAliveInterval 60. /

Received disconnect from host: Too many authentication failures

:, SSH

:ssh-agent, SSH MaxAuthTries

Solutions:

  1. ~/.ssh/config : IdentityFile ~/.ssh/specific_key
  2. IdentitiesOnly yes agent
  3. agent : ssh-add -D
  4. : ssh -o IdentitiesOnly=yes -i ~/.ssh/key user@host
  5. (Recommended): MaxAuthTries 6( /etc/ssh/sshd_config)

: ~/.ssh/config Host IdentityFile and IdentitiesOnly yes, SSH. agent Common