Linux setup SSH login (SECURECRT)

Source: Internet
Author: User
Tags chmod file permissions root access

Background

A complex password is required for each login, and no one is trying to log in to the root account. Feel flustered, so you have to set a more secure way to log in.

Configuring SSH password-free login takes 4 steps
    1. Preparatory work
    2. Generate public and private keys
    3. Import public key to authentication file, change permissions
    4. Test
1. Preparatory work

Confirm the configuration file for native sshd (requires root access)

vi /etc/ssh

1) Modify the following content

Rsaauthentication Yes #设置开启使用RSA算法的基于rhosts的安全验证;RSAAuthentication没有则自行添加。
Pubkeyauthentication yes# Set the public key authentication to open;
Authorizedkeysfile. ssh/authorized_keys# behind the directory, is the public key that you upload to save the file;
Strictmodes no# means to set off SSH to check the permissions and ownership of the user home directory and rhosts file before receiving the login request.
Passwordauthentication no# prohibit login with password authentication

2) Don't worry about starting the SSHD service first

Pilot the key you need to restart the service, or you know the remote do not want to log on.

2. Generate public and private keys

There are three ways to generate a public key:

1) Use the command

cd/root/. SSH Ssh-keygen -t RSA

I haven't tested this.

2) Use SECURECRT to generate the key and upload

Tool tools-Create Public key

Keytype:rsa

Sets the password for the public key that is used at a later logon. You can also not enter a password

Set the public key length: This is the default 2048.

Set the file name of the public key, Id_rsa set here

The following two files are generated when the. pub suffix is the public key, no suffix files when the private key is used (XFTP)

3. Import the public key to the server and change the permissions

1) We copy a public key file [id_rsa.pub] named [Authorized_keys].

2) upload [Authorized_keys] with xftp etc to/root/.ssh/to overwrite the original file.

3) Change file permissions on the server

chmod  /root/. SSH chmod  /root/. ssh/authorized_keys

4) Restart the SSH service

#CentOS versions prior to 7 do:  service sshd Restart#centos 7 please perform:  systemctl restart Sshd.service

4. Test using SECURECRT Login

Secure into the Admin key menu, add the previously created private key file, and enter the password.

Try to log in and log on successfully.

If you can not log in successfully, it must be the disaster of SELinux.

PS for this I got a long time, the entry is difficult!

We can try to close SELinux

Temporarily off (resume after reboot):

0  

Permanent shutdown (requires restart):

vi /etc/selinux/config  selinux=disabled  

 

Linux setup SSH login (SECURECRT)

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.