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 0.0.0.11

# Host 0.0.0.1 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 0.0.0.11

/home/user/.ssh/known_hosts updated.

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



저작자 표시 비영리 변경 금지
신고
블로그 이미지

citadel

memory, life, and logs

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
블로그 이미지

citadel

memory, life, and logs

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

more..



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

https://wiki.ubuntu.com/UbuntuFirewall
신고
블로그 이미지

citadel

memory, life, and logs

티스토리 툴바