Securely run programs on a remote host in Unix

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 (that is, 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 Get help for Linux or Unix at IU.

This is document aidu in the Knowledge Base.
Last modified on 2023-06-28 11:00:45.