Linux Build Trust Host

Source: Internet
Author: User

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1, first install a Sshpass installation package on this machine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2, Ssh-keygen-t rsa-p ""-f/root/.ssh
generate an RSA key on this computer
- T: specifying the RSA algorithm
-P: The pointing option is empty
-F: Specifies the file directory of the generated key
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3.
sshpass-p $root _passwd ssh [email protected] $ip-o stricthostkeychecking=no " Useradd $user && echo $passwd | passwd $user--stdin "&>tips

First log on to the other root user, create a new user, and assign a password to the new user

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ ~ ~
4,
sshpass-p $passwd ssh [email protected] $ip-o stricthostkeychecking=no "mkdir ~/.ssh" &>tips

Telnet to the new user and create a new one in his home directory. SSH folder
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5,
Sshpass-p $passwd scp/home/$ user/.ssh/id_rsa.pub [email protected] $ip:/home/$user/.ssh/authorized_keys &>tips

Copy the RSA key from your computer to the home directory under the new user/home/new user/.ssh
Note: The file name must be Authorized_keys
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6,
sshpass-p $root _passwd ssh [email protected] $ip-o stricthostkeychecking=no "chmod 600/home/$user/.ssh /authorized_keys && chmod 700/home/$user/.ssh "&>tips

Telnet to the new user, Change the folder you just created. SSH permissions to 700, changing the permissions of the Authorized_keys file that you just copied over to the

Linux Build Trust host

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.