Password-free telnet and remote operation

Source: Internet
Author: User

Mainly: the creation and use of key pairs , to master password-free telnet and remote operation

?

Environment:

Local Host 192.168.170.3

Remote host 192.168.155.3

Refer to the previous few to ensure that the local host and the remote host can ping each other

?

(Principles and Procedures:

The local host 192.168.170.3 generates a key pair, then uploads the public key to the remote host 192.168.155.3, and then logs on to the remote host 192.168.155.3 the public key to the authorization key file .

Use a key pair to authenticate, so you can password-free telnet and remote operation

?

1.

On putty, log in as user root 192.168.170.3

?

[Email protected] root]# mkdir-pm. SSH

?

Create a key pair

[Email protected] root]# ssh-keygen-f. Ssh/id_dsa-t DSA

- F is the saved file location after the key is generated

The- T parameter specifies the type of key to generate , and you specify the DSA

?

?

To view the resulting key pair :

[Email protected] root]# cat. Ssh/id_dsa

?

?

To view the resulting public key :

[Email protected] root]# cat. Ssh/id_dsa.pub

?

2. Upload the public key to the remote host 192.168.155.3

?

(First red Place, yes, then enter

The second red Place, enter the password for the remote host 192.168.155.3, and then enter

?

If the remote host 192.168.155.3 adds the public key to the authorization key file, there is no need to enter the password

?

3, Putty connect the remote host 192.168.155.3, add the public key to the authorization key file

?

[Email protected] root]# mkdir-pm ssh

[Email protected] root]# cat id_dsa.pub >>. Ssh/authorized_keys

[Email protected] root]# chmod ssh/authorized_keys

?

4, Local host 192.168.170.3 password-free telnet remote host 192.168.155.3, create file 155.txt

(Content is by170)

?

[[email protected] root]# ssh [email protected]

Last Login:thu-13:12:29 from 192.168.155.1

?

[Email protected] root]# cat > 155.txt

by 170

?

This time password-free Telnet remote host 192.168.155.3 succeeded

?

5. Local Host 192.168.170.3 remote replication 155.txt just created (remote host 192.168.155.3

?

first [[email protected] root]# exit

(Exit Telnet, return to localhost 192.168.170.3)

[Email protected] root]# SCP [email protected]:155.txt. (remote copy)

[[email protected] root]# cat 155.txt (view 155.txt to see if replication succeeded)

?

?

7. Remote operation (remote execution command)

?

Local host 192.168.170.3 remote operation (remote host 192.168.155.3), execute ls-l command

(can be any command)

?

[[email protected] root]# ssh [email protected] ls-l

?

Password-free telnet and remote operation

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.