Linux Remote Execute shell command

Source: Internet
Author: User
Linux Remote Execute shell command

In a Linux system, we often want to execute a shell command on machine B on a machine.

The following scenario is a popular and reliable solution.

1.SSH Login without password

# Local server execution (a machine): Generate key Pair

Ssh-keygen-t Dsa-p "-F ~/.SSH/ID_DSA

# Remote server execution (b machine): With the public key to the remote machine authorization, first need to copy the local public key to the remote server, the remote machine authorization, you can delete the public key

Cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

After the operation, a machine can be no password ssh to the B machine

2. Execution of SPECIFIC commands

SSH [email protected] "/root/nginx/nginx-1.2.3/sbin/nginx-s Reload"

Linux Remote Execute shell command

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.