How to Set Up SSH password-less logon for Ubuntu14.04

Source: Internet
Author: User
Tags openssh server ssh server
Hello everyone, today I will introduce how to set up the SSH password-less logon function on Ubuntu14.04. The SSH server will allow you to log on only when the workstation has a correct (public/private) key pair for matching. Otherwise, access will not be allowed. Under normal circumstances, we need to connect to the SSH console and enter the user name and password. If both are correct, access is allowed. Otherwise, access is denied by the server. However, there is also a more secure login method than using a password. We can use the encryption key to perform password-less login during SSH login.

Hello everyone, today I will introduce how to set up the SSH password-less logon function on Ubuntu 14.04. The SSH server will allow you to log on only when the workstation has a correct (public/private) key pair for matching. Otherwise, access will not be allowed.

Under normal circumstances, we need to connect to the SSH console and enter the user name and password. If both are correct, access is allowed. Otherwise, access is denied by the server. However, there is also a more secure login method than using a password. We can use the encryption key to log on to SSH for password-less login.

If you want to enable this security method, simply Disable password logon and allow only the Encrypted Key to log on. In this way, a private key and public key are generated on the client computer. Then the client needs to upload the public key to the authorized_key file on the SSH server. Before the access is granted, the server and client will verify the key pair. If the public key on the server matches the private key submitted by the client, the access permission is granted. Otherwise, the access is denied.

This is a very safe way to authenticate to an SSH server. If you want to achieve secure login for a single SSH user login, this is also a highly respected method. The following describes how to enable SSH configuration without a password.

 

1. Install the Openssh server

First, we need to update our local database index. As shown in the following figure, we need to enter "apt-get update" first"

  1. $ sudo apt-get update

Run the following command to install openssh-server:

  1. $ sudo apt-get install openssh-server

 

2. Enable the openssh Service

After OpenSSH has been successfully installed on Ubuntu14.04, we need to start the OpenSSH service. Run the following command to start/start the service.

  1. $ sudo service ssh start

Or

  1. $ sudo /etc/init.d/ssh start

 

3. Configure the key pair

After we install and start the OpenSSH service. Now it's time for us to get the public/private key pair. Run the following command on the terminal:

  1. $ ssh-keygen -t rsa

After running the preceding commands, we need to answer a series of questions. First, select the path to save the key. Press enter to select the default path, that is, a hidden. ssh folder in the home directory. The next prompt is a password reminder. I leave this blank (Press ENTER ). Then the key pair will be created.

After the key pair is generatedCopy the public key on the client to the SSH serverOr host to create a trust relationship with the client. Run the following command to copy the public key of the client to the server.

  1. $ ssh-copy-id user@ip_address

After the public key is uploaded, we can disable SSH Login by password. To solve this problem, use the following command to open/Etc/ssh/ssh_config.

  1. $ sudo nano /etc/ssh/sshd_config

Now, we need to remove several lines of comments as shown and assign values.

 

4. Restart the SSH service.

Finally, after configuring the SSH server, we need to restart the SSH service to make the changes take effect. Run the following command on the terminal or console to restart the instance.

  1. $ sudo service ssh restart

Or

  1. $ sudo /etc/init.d/ssh restart

Now, we can try to log on to the ssh server by using a key pair instead of a password.

 

Summary

Great! We have successfully configured a password-free logon to SSH. It is very secure to use an encrypted key pair for SSH Server Authentication. If you want to implement security authentication for a single user login over SSH, this is also a highly respected method. Therefore, if you have any questions or suggestions, please submit your feedback in the comments box. I'm glad you have read this article. I hope you will like encrypted SSH secure logon :-)

Approach to improving the SSH login authentication speed for Ubuntu http://www.linuxidc.com/Linux/2014-09/106810.htm

Enable SSH service for Android phones to remotely access Ubuntu 14.04 http://www.linuxidc.com/Linux/2014-09/106809.htm

How to add a dual authentication http://www.linuxidc.com/Linux/2014-08/105998.htm for SSH in Linux

Configure the SFTP environment http://www.linuxidc.com/Linux/2014-08/105865.htm for non-SSH users in Linux

Http://www.linuxidc.com/Linux/2014-06/103627.htm for configuring and managing SSH services on Linux

SSH getting started basic learning tutorials http://www.linuxidc.com/Linux/2014-06/103008.htm

SSH password-free login details http://www.linuxidc.com/Linux/2015-03/114709.htm

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-04/115825.htm

Related Article

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.