ubuntu under SSH password-free login settings

SSH server: A
SSH Port A: portA
username A is: NameA
the IP of A: IPA

SSH access terminal: B
Username B's: NameB
the IP B is: IPB
effect: B A visit by SSH
. 1) confirms that ssh is installed (confirmed by restarting)
-Service the sshd the restart or service ssh restart
if it can restart the instructions to install the ssh, If the ssh: unrecognized service is not installed correctly SSH instructions
to install the install SSH OpenSSH GET-by-APT server
2) whether there is at ssh or sshd view /etc/init.d/
. 3) server A: modify / etc / ssh / sshd_config profile
#PermitRootLogin the without-password
the PermitRootLogin Yes
RSAAuthentication Yes
PubkeyAuthentication Yes
. 4) generates a secret key and a public key (generated skippable)
SSH-keygen -t RSA
all the way round keys may be generated (id_rsa) and public key (id_rsa .pub)
. 5) access B is added
to a, B's public key copying /root/.ssh/authorized_keys end of file
, or by ssh-copy-id nameB @ IPB
If the port number is not SSH port 22 through
ssh-copy -id "-p portA nameB @ IPB"
After adding a password can not
be tested by A native
add access B test after the successful
SSH NameA @ IPA -p portA
6) the WARNING: REMOTE HOST the IDENTIFICATION HAS CHANGED is
this problem may be due to the access of public IP resulting in different information known_hosts and delete IP B in the known_hosts corresponding information can be rsa
7) If the connection fails port via telnet AIP -p portA view port is open, by
ufw sudo enable (enable)
sudo ufwdisable (disabled)
if the firewall because the firewall to test lead to the port is prohibited

Opening or closing a port, for example:
the sudo ufw the allow 22 / # allowed TCP 22 / IP TCP all external access to the machine (ssh) port
sudo ufw deny 22 / tcp # allow all external access to the machine 22 IP / tcp (ssh) port

Guess you like

Origin blog.51cto.com/14447492/2420639