How Linux implements remote control of shell commands

  

We all know that shell commands can be easily executed under Linux. Can you execute shell commands on other computers on other computers? In fact, it is ok, the following small series will introduce you to the Linux remote control method of shell commands.

No 1.SSH password

# the local server performs (A machine): generating a key pair

ssh-keygen -t dsa -P & lsquo; & rsquo; -f ~/.ssh/id_dsa

# Remote server execution (B machine): Authorize the remote machine with the public key, first need to copy the local public key to the remote server, the remote machine is authorized , you can delete the public key

cat ~/.ssh/id_dsa.pub 》~/.ssh/authorized_keys

After the operation, the A machine can SSH to the B machine without password.

2. Execute specific commands

ssh [email protected] “/root/nginx/nginx-1.2.3/sbin/nginx -s reload”

It is the method of remotely executing shell commands from Linux. Through the method of this article, you can remotely execute shell commands on other computers, saving you time.

Copyright © Windows knowledge All Rights Reserved