With Linux, life becomes more interesting, I would even say more experimental!
I was drawn to experiments with ssh, and what I got in the end - access from work to my home computer - I really liked it! It would be nice to manage your home computer, update it, etc. I even talked to the girl with the help of festival)))
However, I wanted to go further, I wonder if it is possible to set up remote desktop access, as RAdmin allows in Windows? Of course it is possible! You just need to configure))
I rummaged through the Internet, found several articles about
VNC - Virtual Network Computing , decided to make such happiness at home!
To do this, first it was necessary to put several utilities:
sudo aptitude install vnc4-common vnc4server xvnc4viewer
These utilities are needed directly in order to start a remote server (vnc4server) and connect to it from a remote client (xvnc4viewer).
Installed! Now it remains for the small: you first need to start the vnc server, and then connect to it.
To start a remote server, you need to type in the console
vncserver
If this is the first launch of vncserver on the system with this user account, then you must enter the password that clients will use when connecting, after which the server will be started, which will be available on port 5901. By the way, when you start the server, the display number (virtual ), on which it will be available, the countdown is from 1 (since 0 is the current display). Startup example:
')
igor@Voyageur:~$ vncserver
New 'Voyageur:1 (igor)' desktop is Voyageur:1
Starting applications specified in /home/igor/.vnc/xstartup
Log file is /home/igor/.vnc/Voyageur:1.log
Here, the line
New 'Voyageur: 1 (igor)' desktop is Voyageur: 1 just says that my computer has started the server on display 1, it is available on port 5901.
If vncserver is launched again, the new terminal server will be loaded: 2 on port 5902, etc.
Now we will try to access this server from a remote machine. To do this, enter the following command in the remote client console:
vncviewer __hostname__:1
In this command, __hostname__ is the domain name or ip of the machine on which the remote server is running. Next, you will need to enter a password and as a result approximately this window will appear:

I expected to see a little something to be honest.) I started to understand, and it turned out that vncserver starts only a new session, but does not connect to the current one, this is what virtual displays are for. And in this session, twm (Tab Window Manager for the X Window System) and xterm are running.
By the way, this is all good started from the ~ / .vnc / xtartup script, which can be edited, removing unnecessary and adding your own lines of launching the necessary applications. At the very top of the script there is a small comment:
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
That is, to get a normal desktop, you need to uncomment 2 lines. I uncommented them, but nothing good came of it.
I looked at this twm, and decided that it was impossible to work with this misery. I installed fluxbox (it takes only 6 MB) and in the xstartup script I replaced the line
twm &
on
fluxbox &
In the end, I did this:

Normal for work. But not ice! The opera can be launched, some more applications, but not all (kde applications break out)! I tried to run kde instead of fluxbox, but it didn’t go ... A welcome sign was playing, but a window crashes with the collapse of the plasma and everything, a black screen, a curtain ...
As a result, I received remote access, but not the way I wanted! I wanted to have access to the current desktop, and not to the mythical display 1, where fluxbox is loaded, but not kde.
What to do? Need to dig more !!!
I searched the repositories for packages that have “vnc” in their names, the list was not very big, I started reading the comments to utilities and libraries ... At the very end of the list I saw the following line:
p xvnc4viewer - Virtual network computing client software for X
Very similar to what I need!
I installed x11vnc ... man at this utility notable, several thousand lines)) After learning a little of it, I more or less understood the startup procedure and the purpose of the utility.
So, x11vnc is actually a remote server (like vncserver), but allows access to an existing X session!
On the machine you want to connect to:
x11vnc -storepasswd
This command will allow you to borrow the password to connect to the server from the ~ / .vnc / passwd file (here lies the password that was set when you first started vncserver). Next, let's run x11vnc directly:
x11vnc -usepw -display :0
The
-usepw option
enables the use of a password when connecting to the server,
-display: 0 - starts the server on a zero display (as where the current X session is open).
Now we can connect to the current X-session from the remote machine by running
vncviewer __hostaname__:0
and entering a password.

When you close the remote desktop window, x11vnc (on the server) also terminates
So I got what I wanted))))
Finally, here are a few options for the vncserver, x11vnc and vncviewer utilities that facilitate traffic and life))
vncserver:- -kill: n - terminates the terminal server on the display n (port 590n), if it was previously started
- -geometry 800x600 - sets the size of the desktop to be created (1024x768 by default)
- -depth depth - sets the color depth in bits, the default is 16 bits, can be changed to 8, 15, 24
- To start the VNC server with a specific number (display), use the vncserver command: n
x11vnc:- -q - reduces debug output to stderr
- -forever - this option does not shut down the x11vnc server when the first client disconnects and waits for the next connections
vncviewer:- -geometry 800x600 - sets the size of the window in which the remote desktop will be displayed. If the specified size is less than the size of the remote table, scroll bars will appear.
- -compressionlevel n - sets the level of data compression. The value of n varies from 0 to 9, 9 - the best compression (quality, respectively, worse)
- -quality m - affects the quality of the picture. m ranges from 0 to 9, 0 - the worst image quality (less traffic)
- -depth depth - if the X-server supports different values ​​of the color depth, then you can try to find the optimal value (in bits)
- -viewonly - an option that allows the connecting user to only observe what is happening on the remote machine; controls (mouse, keyboard) are not available
PS By the way, if you want x11vnc to start automatically, then for this you need to add it to autoload: in the System Preferences, select the Autorun item (on the second tab), add the script there
x11vnc -usepw -display :0 -q -forever &
and indicate that it should run before KDE starts!