You need to use ssh X forwarding feature. This is default feature of OpenSSH ssh client. All you have to do is run command as follows:
ssh {user@server-ip} -f -X {app-name}[donotprint]
Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | No |
Requirements | OpenSSH ssh client/server |
Time | 2m |
OR
ssh -f -X {user@server-ip} {/path/to/app-name} -arg1 -arg2
OR speed up with compression of all data:
ssh -f -X -C {user@server-ip} {/path/to/app-name}
Where,
- user@server-ip : Your remote login username and password
- -f : Requests ssh to go to background just before command execution. This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in the background. This is the recommended way to start X11 programs at a remote site/host.
- -X : Enables X11 forwarding.
- -C : Requests compression of all data (including stdin, stdout, stderr, and data for forwarded X11 and TCP connections).
- -c cipher : Selects the cipher specification for encrypting the session.
- -T : Disable pseudo-tty allocation.
Example: Run ssh in the background
For example run xterm (x windows terminal) or xeyes app as follows and go into background, enter:
$ ssh vivek@d1.vpn.nixcraft.in -f -X xeyes
$ ssh vivek@d1.vpn.nixcraft.in -f -X xterms
$ ssh vivek@d1.vpn.nixcraft.in -f -X /opt/firefox/firefox
Tip: Speeding up slow links over ssh with compression
If you think that programs are running slowly because of a lack of bandwidth or network congestion, you can turn SSH compression by passing the -C option as follows:
$ ssh vivek@d1.vpn.nixcraft.in -f -X -C xeyes
$ ssh -fXC vivek@d1.vpn.nixcraft.in xterms
$ ssh -fXCT vivek@d1.vpn.nixcraft.in /opt/firefox/firefox
## Set ciphers. Blowfish is a fast block cipher; it appears very secure and is much faster than 3des ##
$ ssh -f -X -C -c blowfish-cbc,arcfour vivek@www544.nixcraft.net /path/to/raid-config-app
See also
- Man pages – sshd(8)
🐧 1 comment so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Thanks for this tip. I was struggling to find a way to fun a remote x11 application in the background. The ‘-f’ flag was the key