Differences Between VNC And Ssh -X - Unix & Linux Stack Exchange

    1. Home
    2. Questions
    3. Tags
    4. Users
    5. Jobs
    6. Companies
    7. Unanswered
  1. Teams

    Ask questions, find answers and collaborate at work with Stack Overflow for Teams.

    Try Teams for free Explore Teams
  2. Teams
  3. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams Differences between VNC and ssh -X Ask Question Asked 14 years, 3 months ago Modified 4 years, 11 months ago Viewed 66k times 39

Why would you use VNC (or for that matter NX) instead of just using ssh -X (-Y). I read that VNC uses less bandwidth, but is there any other differences/advantages with respective tool?

Share Improve this question Follow asked Sep 12, 2010 at 23:29 The Silent Boatman's user avatar The Silent BoatmanThe Silent Boatman 6971 gold badge7 silver badges9 bronze badges Add a comment |

4 Answers 4

Sorted by: Reset to default Highest score (default) Date modified (newest first) Date created (oldest first) 39

Aside from bandwidth and latency issues (which can vary a bit), the big differences are the functionality it provides.

VNC exports a whole session, desktop and all, while ssh will run a single program and show its windows on your workstation.

The VNC server exports a session that survives even when you disconnect your screen, and you can reconnect to it later with all the windows open etc. This is not possible with an ssh X tunnel, since when your X server dies, the windows go away.

Share Improve this answer Follow answered Sep 13, 2010 at 6:34 dkagedal's user avatar dkagedaldkagedal 7761 gold badge5 silver badges10 bronze badges 4
  • 7 That's the biggest reason I always use VNC, never direct X window. (I use VNC over a ssh tunnel). When I close the lid on my laptop, the connection is broken. With ssh -X, there is no way to resume -- I have to re-start the application from the beginning. With VNC (both direct and over a ssh tunnel), I can reconnect and continue right where I left off. – David Cary Commented Sep 14, 2010 at 17:06
  • 13 Although a bit OT (since this Q is presumably only about GUI apps): if an actual GUI app is not required, and just basic shell access will do (e.g., xterm), then do "ssh" followed by "screen bash". If disconnected (laptop closed,vpn disconnected, etc), the remote shell stays active. Re-login & re-connect via "screen -r". I only bring this up since I've seen people run vnc just for basic shell access (or run a remote xterm displayed locally); most of the time (but of course not always), simple shell access will suffice. – michael Commented Nov 16, 2012 at 11:38
  • 1 @michael_n I am interested to this thing you say about screen bash, but I am not able to make it work. I typed 'ssh -X -t myusername@remotehost screen bash' and after the connection drops I type 'screen -r', but it says 'there is no screen to be resumed'. what should I do? – simona Commented Nov 21, 2012 at 12:34
  • 3 @simona after the successful ssh login, then run screen: ssh user@host ; and after logged in: screen bash ; to disconnect, ctrl+a followed by ctrl+d. You can logout and login again, then: screen -ls and screen -r. Exiting bash exits the screen session. For more (much more), see various tutorials on GNU screen – michael Commented Nov 29, 2012 at 9:25
Add a comment | 12

ssh -X redirects X11 commands to your local X server. So it is as if you were running the program locally, when it's really running on the computer at the other end. It's very slow because it uses a great deal of bandwidth. (This is what people are talking about when they say X11 is "network transparent.")

VNC and other remote desktop apps instead let the other computer process all of the graphics drawing and so forth and captures, in essence, a screenshot and sends that back to your computer. It can seem much faster, because far less information is required to display everything. However, it also sends the whole desktop, rather than a single application.

I don't recommend using ssh -X over the Internet for one simple reason: It will use all of your available bandwidth. It's fairly useful over a LAN, in my opinion, so if you just need one application and don't want to have to run a whole desktop, this is a good way to go. Otherwise, just use VNC.

Share Improve this answer Follow edited Sep 13, 2010 at 4:19 answered Sep 13, 2010 at 1:54 greyfade's user avatar greyfadegreyfade 6403 silver badges7 bronze badges 3
  • 3 "It's very slow because it uses a great deal of bandwidth. The X11 protocol is very complex and often involves sending large pixmaps back and forth across the connection." - this is wrong, the X11 protocol isn't very complex and it doesn't involve sending large pixmaps back and forth across the connection. Come and join this proposal to learn more about the X Window System: area51.stackexchange.com/proposals/20129/the-x-window-systemdelete Commented Sep 13, 2010 at 4:09
  • 1 @Sherlock: Well, the fact remains that it uses a lot of bandwidth. I deleted the offending sentence. – greyfade Commented Sep 13, 2010 at 4:19
  • 1 NX is an efficient way to transmit X11 protocol data over the network. It compresses the data, provides extensive caching and tunnels sessions over SSH. – Adam Byrtek Commented Sep 15, 2010 at 16:43
Add a comment | 5

VNC will share an entire desktop from a remote system. It requires a full-fledged desktop on the remote system.

ssh -X allows you to run single X application from a remote server. The remote system does not need to be running a complete desktop, and you often only need a handful of packages to be installed on the remote system.

ssh -X can be useful when installing complex software packages over a remote connection. Some software products may use a GUI installer (Oracle Database, etc). I don't want to install and a full-fledged Gnome desktop on my remote server. So, you install one or two X11 packages (Xauth?) on the remote server, and allow the DBA to run the Oracle installer remotely using something simple like 'ssh -X /media/cdrom/oracle-installer'.

Share Improve this answer Follow edited Sep 13, 2010 at 21:30 answered Sep 13, 2010 at 3:03 Stefan Lasiewski's user avatar Stefan LasiewskiStefan Lasiewski 20.4k24 gold badges71 silver badges86 bronze badges Add a comment | 3

There is also a security advantage when using VNC or NX (X2Go). A malicious app cannot take screenshots or use a keylogger to log keys of your real desktop, while it is possible using SSH with X11 forwarding even if the malicious app runs in background.

If you use SSH -X (or -Y), you should trust the app (e.g. open source app that comes from an official Linux distribution package) or avoid doing sensitive work while running it.

I was able to verify this with these cross-platform and open source tools (tested in an LXC container):

https://github.com/lxqt/screengrab

https://github.com/GiacomoLaw/Keylogger

Share Improve this answer Follow answered Jan 17, 2020 at 21:00 baptx's user avatar baptxbaptx 2872 silver badges12 bronze badges Add a comment |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .

  • The Overflow Blog
  • Developers want more, more, more: the 2024 results from Stack Overflow’s...
  • How AI apps are like Google Search
  • Featured on Meta
  • The December 2024 Community Asks Sprint has been moved to March 2025 (and...
  • Stack Overflow Jobs is expanding to more countries

Linked

4 More efficient X-forwarding? 5 Why is an application via 'ssh -X' slower than vncviewer via 'ssh -X' 0 Protecting VNC server with SSH tunneling without preventing iPhone connection 0 VNC via SSH stopped working 0 VNC (tigervnc) via 'actual' ssh tunnel

Hot Network Questions

  • Recreating lab integrator result in LTspice simulation
  • Correspondence of ancient 天关 in western astronomy
  • Did a peaceful reunification of a separatist state ever happen?
  • Basic, general lexer for a programming language
  • Is copper anti-seize good for aluminium?
  • What's left of wine or vodka after the water and alcohol is boiled off?
  • Is there any denomination which officially rejects Young Earth Creationism?
  • I saw this article online that mentioned animal testing for immersion in water for applications in astronauts. What plans might require this?
  • Poincaré and the principle of induction
  • Most commonly played openings for a draw at GM level (2500+Elo)
  • Can you connect isolated power supplies in series
  • Can I get an outlet installed inside the cabinet with out disturbing the backsplash
  • What is the origin of "litera" versus "littera"?
  • Is it possible to get symbolic integral for this?
  • writing two matrices in a clear and nice way
  • What bladed melee weapon would be best suited for a warrior in zero-gravity?
  • Does the Nondetection 10 feet limit only apply to objects?
  • Colombian passport expires in 5 months
  • Frequency identification via Fourier when wave period is larger than dataset length
  • Maximal subgroup contains either the center or the commutator subgroup
  • The third person preterite of "CRIAR" is "crio" without accent instead of "crió¨with accent?
  • meaning of "last time out"
  • What happened to 1T-SRAM?
  • Inverting band pass filter circuit not showing theoretical behavior at all in SPICE simulation. What am I missing?
more hot questions Question feed Subscribe to RSS Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Từ khóa » Xorg Vs Vnc