Chris
Chris

Reputation: 1008

Sending shell commands to a Linux server over the network

Is there a tool that will allow me to issue commands over the network without SSH?

For example, I'd like to create a new linux box armed with DVD burners and send this command over the network "growisofs -dvd-compat -Z /dev/dvd -dvd-video dvd" with arguments and send the file to burn. The system would be automated so I need something that can do this easily and efficiently.

Upvotes: 0

Views: 4072

Answers (2)

Cascabel
Cascabel

Reputation: 496822

Here's my comment in elaborated answer form.

On the local host, run ssh-keygen, most likely saving the key in the default location and not using a passphrase. Next, use ssh copy-id <user@host> to copy the public key to the remote host.

For your script, do something like:

scp "$FILE_TO_BURN" $REMOTE_USER@$REMOTE_HOST:"$BURN_DROP_DIR"
ssh $REMOTE_USER@$REMOTE_HOST $BURN_COMMAND
ssh $REMOTE_USER@$REMOTE_HOST rm "$BURN_DROP_DIR/$(basename $FILE_TO_BURN)"

Feel free to flesh it out with error detection by capturing the exit status/output of the ssh commands. You might also want to look into doing this without copying the whole file first using something like sshfs (packaged by most distros) to mount the directory containing the file to burn over the network.

Upvotes: 1

Rushyo
Rushyo

Reputation: 7604

You could use netcat with a shell bind. This is, of course, quite dangerous if the network is publicly exposed.

Google search

Upvotes: 0

Related Questions