The method and use of Linux to generate key

Source: Internet
Author: User

Transferred from: http://blog.163.com/tqq_0716/blog/static/7690741220110611350344/

Server a:192.168.1.1

Server b:192.168.1.2

Server A:

Configuration:

Ssh-keygen-b 2048-t RSA

#这里的-B 2048 is the length of the key encryption, it is best to set a large point, there is a message that the United States has hackers to solve the SSH key to crack.
#http://bbs.yuloo.com/thread-860154-1-1.html

Direct Enter 3 times

The key file will be saved in the/ROOT/.SSH directory

At this point, SSH will have a few more files.

Id_rsa private Key File

Id_rsa.pub the public key file, the contents of this file should be placed in other hosts.

View Id_rsa.pub File

Cat/roor/.ssh/id_rsa.pub

Ssh-rsa aaaab3nzac1yc2eaaaabiwaaaicavh6lz9ghftghtfghsv+ksrxvlc9udkq27mg5vhfghaawcgfgllzhfg2dlngotmel/08bp6jmw/ eksq1by1eiouiluiliuliul2rr84x0bb5yshhpgjwupbwr/pymgukyukyukyuthjkiytiliunzdfkuykyuizgvvgptzndn/ rdwjmsafsdvgsdsfsdfdsfsdaflozstycwjrwzyxsrodpby4zjd0gh5zmyhj+vs4ooazz8rthefx+ste0= [email protected]

Server B:

Configuration:

New folder and file

Mkdir/root/.ssh

Vim/root/.ssh/authorized_keys

Copy the contents of the key file viewed on server A to the Authorized_keys of server B

The main thing is to change [email protected] to [email protected] so that it is easy to see which server's key, there may be more than one server key.

Modify the main profile of sshd, turn off password Authentication login, use key to login.

Vim/etc/ssh/sshd_config

Find Passwordauthentication Yes

Change to Passwordauthentication No

Service sshd Restart

Test:

Execute on Server A

SSH [email protected]

The first login will require you to enter Yes. See if you don't need a password to log on to B service.

The method and use of Linux to generate key

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.