Once I try to connect a fresh new installed system, which has the same name or ip before through ssh,  logging in to the client may fail. The reason is that the new system has the different host key. In that case, find the host key and remove them, and try to connect to it again. The new updated host key will be saved into $HOME/.ssh/known_hosts

Find the Host Key as : 

user@host:~$ ssh-keygen -F

# Host found: line 25 type ECDSA

|1|fqIKruXgQiBiaC3m8BBjyMTyxjE=|tn1kZ4Xc0QFRHtP9ktfjfAfH6tU= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyN6644sgxjr4zdHAyNTYAAABBBCnqFheVaXkvg6Zozli0WpkMRcPgOtir9X3t58loczY9//iTSWdKBEHNVKBP+DaTAII/JRs/7Id0vD8G1vGpFd8=

Remove the Host Key as :

user@host:~$ ssh-keygen -R

/home/user/.ssh/known_hosts updated.

Original contents retained as /home/user/.ssh/known_hosts.old

posted by citadel
Generate Key...

# 1) [A] ssh-keygen -t dsa -b 1024 -f $HOME/ssh-key <enter/enter>

# 2) [A] scp ssh-key.pub B:~/.ssh/
# 3) [B] cat B:~/.ssh/ssh-key.pub >> $HOME/.ssh/authorized_keys
        [B] chmod 700 $HOME/.ssh/authorized_keys
# 4) [B] rm ssh-key.pub
# 5) [A] alias B='ssh  -i ~/.ssh/ssh-key -Y -C user@B'

Make config ...

[A] emacs .ssh/config

Host *
ForwardX11 yes
ForwardAgent yes
VisualHostKey yes                                                                       
PermitLocalCommand yes
IdentityFile ~/.ssh/ssh-key
Compression yes
CompressionLevel 6

ssh B

'Computer > linux' 카테고리의 다른 글

Using parted, add a new 2TiB HDD  (0) 2011.01.26
ssh connection without typing password  (0) 2011.01.19
several find commands  (0) 2011.01.18
Error read: Connection reset by peer when sshfs is using.  (0) 2010.12.21
posted by citadel
sshd configuration
open /etc/ssh/sshd_config file, change and add the following lines

LoginGraceTime 60
PermitRootLogin no

MaxAuthTries 3
AllowUsers user_name

MaxStartups 3:50:10


ufw (Uncomplicated Firewall)

apt-get install ufw

ufw enable | disable
ufw default allow | deny
ufw allow from x.x.x.x
ufw deny from x.x.x.x

posted by citadel