Ubuntu under SSH password-free login settings

Source: Internet
Author: User
Tags ssh access ssh port ssh server

SSH Server side: A
SSH Port of A: PortA
A's user name: Namea
A's Ip:ipa

SSH Access port: B
User name for B: Nameb
B's IP:IPB
Effect: b accesses a through SSH
1) Confirm that SSH is installed (confirm by restarting)
Service sshd Restart or service ssh restart
If it is possible to restart the instructions if SSH is installed, if the Ssh:unrecognized service instructions are displayed, SSH is not installed correctly
Installing SSH via Apt-get install Openssh-server
2) See if SSH or sshd exists under/etc/init.d/
3) server-side A: Modify the/etc/ssh/sshd_config configuration file
#PermitRootLogin Without-password
Permitrootlogin Yes
Rsaauthentication Yes
Pubkeyauthentication Yes
4) Generate secret key and public key (generated can be skipped)
SSH-KEYGEN-T RSA
Return to the key (ID_RSA) and public key (Id_rsa.pub)
5) Add B access rights
Copy the public key of B to the end of the/root/.ssh/authorized_keys file of a
or by Ssh-copy-id [email protected]
If the SSH port number is not port 22nd, pass
Ssh-copy-id "-p PortA [email protected]"
Once added, you can login without a password.
Can be tested by a native
Add access to B after the test is successful
SSH [email protected]-P PortA
6) Warning:remote HOST identification has CHANGED
This problem may be due to the access of the IP's public key information is different from the known_hosts, the removal of the IP of the known_hosts in the corresponding RSA information can be
7) If the connection port fails, you can use Telnet aip-p PortA to see if the port is open by
sudo ufw enable (enabled)
sudo ufwdisable (disabled)
Firewall to test if the port is blocked due to a firewall

Open or close a port, for example:
sudo ufw allow 22/tcp #允许所有的外部IP访问本机的22/tcp (SSH) port
sudo ufw deny 22/tcp #允许所有的外部IP访问本机的22/tcp (SSH) port

Reference article:
Http://www.linuxidc.com/Linux/2016-12/138259.htm
http://roclinux.cn/?p=2551
http://blog.51cto.com/linuxme/375752
http://blog.csdn.net/universe_hao/article/details/52296811

Ubuntu under SSH password-free login settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.