In Unix, how do I securely run programs on a remote host?

Note:
These instructions assume you are using OpenSSH and are trying to run an X11 program remotely. If you receive an error about -X not being an option, try leaving it out or replacing it with +x (i.e., ssh +x -f host command).

If you want to run programs securely on a remote host you can use SSH or SSH2 to run X Window (X) applications and many command-line applications that reside on a remote Unix host. To do this, at the shell prompt, enter:

  ssh -X -f hostname command

Replace hostname with the name of the remote host, and command with the name of the application. If you have not set up public key authentication, you will be asked for your password on the remote host. If you have set up public key authentication, you will be asked for your private key password.

For example, assuming you are running X, you could start xemacs from the computer deathstar.empire.gov by entering the following:

  ssh -X -f deathstar.empire.gov xemacs

If your username on the remote host is different from your local username, the following command will work:

  ssh -X -f username@host command

So, again assuming you are using X, to run xemacs on deathstar.empire.gov under the username dvader, you would enter:

  ssh -X -f dvader@deathstar.empire.gov xemacs

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document aidu in the Knowledge Base.
Last modified on 2017-05-16 11:50:49.

Contact us

For help or to comment, email the UITS Support Center.