[kanchilug] 1D1C - rsh

  • From: Dhanasekar <tkdhanasekar@xxxxxxxxx>
  • To: ilugc@xxxxxxxxxxxxx, kanchilug@xxxxxxxxxxxxx
  • Date: Wed, 25 Jan 2023 06:00:00 +0530

rsh command executes commands on a remote shell.

syntax
$ rsh remote-machinename/ip command

To run a command on remote-host
$ rsh remote-host ls
$ rsh remote-machine/ip mkdir ~/Desktop/testfolder
$ rsh remote-machine/ip mv -v ~/Desktop/*.txt ~/Desktop/tesffolder/
$ rsh 192.168.122.50 hostname

To run command on remote-host as different user
$ rsh -l user2 192.168.122.50 whoami

To run multiple commands in the remote computer
$ rsh -l user2 192.168.122.50 "pwd ; ls"

To run commands with sudo privileges on the remote system
$ rsh -l user2 192.168.122.50 sudo -S deluser user3

To run local scripts on the remote system
$ rsh -l user2 192.168.122.50 bash test-script.sh

To save the remote system’s output to the local system
$ rsh -l user2 192.168.122.50 ps > running_process.txt



regards,
T.Dhanasekar

Other related posts:

  • » [kanchilug] 1D1C - rsh - Dhanasekar