Remote connection to Linux desktop from Windows.  How can I remotely connect to a Windows computer from Ubuntu?  Connecting to ubuntu desktop

Remote connection to Linux desktop from Windows. How can I remotely connect to a Windows computer from Ubuntu? Connecting to ubuntu desktop

We all want to work where we are comfortable, and remote access to systems - a very convenient thing. Many remote system workers are designed to connect and configure their hosts. For companies, this is ideal; Well, what do fans need it for? Of course, all enthusiasts want to have more than one computer, and in such a case it will be convenient to connect through your own network or even through the Web.

There are applications that we do not want to run directly on our computer. There can be many reasons for this: for example, you pretend to be at home, while you are actually abroad. This is of course achievable thanks to a VPN. In addition, you may want to dedicate a separate system for certain tasks or simply administer home system automation.

A common cause for enthusiasts is performance issues. Laptops capable of processing the latest animation or compiling your latest iteration of a program are prohibitively expensive, and the same system can be obtained in the form of a desktop PC for a relatively modest amount. If you are working with Blender, rendering can be done remotely, and on the local computer, it can be limited to displaying the entire application. Your development environment may be memory intensive, and while waiting for the program to compile, you'd happily switch off and do something else.

So what are your options?

In the beginning there was an X option for SSH (-X). And it worked pretty well - when your remote computer was not far away, but next to you, and you had a guaranteed bandwidth of 100 Mb / s. Using SSH in this way is only convenient if you have a server without a mouse, keyboard and monitor to work with your tasks - most likely, file server or something similar. If you want to use an old desktop PC that's gathering dust in your pantry, or if you're constantly away, this won't be enough.

Double the fun

There are a number of features that you will miss out on when using SSH running on another machine. The two most important are the compression and session resuming functions. You may have heard of Citrix - this commercial solution has a huge number of features that many enterprises find very useful, but ordinary users they only complicate matters.

There are many clients, or viewers, for the local computer, and many are adapted to your desktop. As usual, anything that starts with 'g' is for the GTK toolkit. Most callers are included with your distribution and can be added via the package manager. Your author uses the tigervnc viewer and an SSH channel to access their servers.

When testing this, you should start by installing and configuring the server, and then you can add different clients. Installing a VNC server on a remote machine requires root privileges, unless you decide to use a user-space tool like Linuxbrew.

The installation procedure uses the usual package management commands:

$ sudo apt install vncserver

$ sudo yum install vncserver

To set up the server, you can just leave it as is, because the default settings are quite reasonable.

Now the trick is to make sure all ports are open, and here again we need root privileges. Typically vncserver starts at port number 5901 and works its way up through the numbers. However, this number can be assigned to anything, as long as you do not confuse your buddies or access common ports. Since the VNC protocol is insecure, this approach is not recommended unless you are using it inside your own network and over a wired connection.

However, to improve security, port 59xx should be disabled. To do this, add the "localhost" option as a single line to ~/.vnc/config. The following applies to the example above, but in this format:

A system with these settings requires an SSH channel to work. Speaking of him...

SSH channel from here

To provide yourself with encrypted communication, you need to create an SSH channel from your local computer.

When you open an SSH channel, you need to know the port used for VNC connection. Fortunately, if you are the only user of the remote server, you can choose the port beforehand. And here's how it's done.

First select a port. Here we have taken 5906, and hence the display (6). To avoid other VNC sessions on the local PC, we started with 5910 on the local side of the link. When setting up the full system, choose a more memorable port range: $ ssh -L 5910:localhost:5906 On the remote host, start vncserver; you may need to specify some parameters to customize the screen and display rate.

In this case, we want to start a session that will survive even if the connection drops or we close the viewer. When this mode is enabled, you must set a VNC password. So on the remote server run

$vncpasswd[your_password]

This is a password separate from the user password, but it can be anything, as long as you remember it.

To start a server instance, simply run the command and it will assign the next display. In our case, we want to start the display (namely, 6), so the command looks like this:

$ tigervncserver - xstartup /usr/bin/xterm : 6

New'DS-Tage . matstage : 6 (matstage ) "desktop at : 6 on machine DS - Tage . matstage

Starting applications specified in / usr / bin / xterm

Log file is /home/matstage/. vnc / ds-tage. matstage : 6.log

To connect to the VNC server, use the command xtigervncviewer -SecurityTypes VncAuth -passwd /home/matstage/.vnc/passwd:6.

As you can see, the server starts up and tells you what to do to work with it. However, we need to access it from another computer, so we have to run a slightly different command to get it to display correctly. Number 6 in the instructions refers to the display, and it must connect via an SSH channel; in this example, we've connected 5910 to 5906. When setting up a complete system, choose a more memorable port range.

If you start the subscriber without a password, you will see a window for entering it:

$ xtigervncviewer localhost : 5910

It is very easy to make another mistake: connect to the wrong port. In this case, on the server side, you will see a message that says: ‘ channel 3: open failed: connect failed: Connection refused. This is a good sign that there is a connection between the computers and that you just need to tweak the settings.

When your computers are on the same network and you want to avoid the overhead of encryption, you can connect to a remote host and the appropriate port without tunneling. This session will survive the disconnect.

To stop your session, you can either log out of your remote session or disconnect your session via SSH.

But you need to stop the session, first finding it. To make sure you don't have uncontrolled sessions, first make a list of them:

You now have full control over your desktop PC and can enjoy multiple PCs from anywhere. Keep in mind that this session will survive a disconnection and continue running even if you stop vncviewer.

To make more options available from your viewer, install ssvnc on your local machine. Ssvncviewer is an advanced version of the viewer with many useful options, the most important of which is the SSH helper mode. To use assistant mode, first understand the GUI options and then create a profile according to your requirements. When you run it, there will be many options for launching vncviewer, including an SSH command window. Here you can enter any command you want to run before connecting. So, in this example, starting vncserver is a valid action:

$ vncserver - useold - name Blender - xstartup awesome : 6

In this command, you see the -useold option. It will force the server to use an already running instance. You can also see that we have already selected our window manager. This preference can also be specified in configuration files - more on that later. When launched, the viewer has the option to change settings. Many of these settings control quality, so you can make your desktop or application respond quickly even with low bandwidth.

To access these features, you press F8 while the viewer is running. An ssvnc popup will appear and you can choose from a list. Starting at the top of the list, you have the full screen option. Sending, F8, F9 and Ctrl+Alt+Del from a remote PC are blocked because the viewer uses them. Further down the list are the quality settings that you can change.

Other options in this pop-up list work with color - you can change the color depth and return to grayscale. From the same window, the file transfer window is launched. This is a Java program with one column for each side of the connection and buttons in between for selecting files and uploading them.

The private configuration files for ssvnc are located in the .vnc/ directories, where you will find files for other VNC packages as well.

Some of these packages are described below. You also have encrypted passwords and RSA keys for authentication. The profiles you create from the ssvnc GUI are stored here in case you need to make changes using the command line.

The other big solution is RealVNC, but although it's free and open source, it's a commercial service. However, there is a free option - a home subscription, which can be used for five or fewer computers.

One of the requirements is that the subscription must be activated from the desktops of the computers that you want to control remotely. Since the computers are probably somewhere in your home, desktop usage won't be too high a request.

Time to be real

To install RealVNC, go to its page (www. realvnc.com) and download the VNC connect package for the computer you want to control. Proceed with the installation in the same way as for normal packages for your distribution.

$ sudo dpkg -i VNC - Server - 6.2.0 - Linux - x64 . deb

When the program is installed, it will launch and appear on your desktop in the notification bar or your desktop equivalent. Next, open the GUI and connect to your account RealVNC, which you probably already created. Once you sign in, the computer will appear in your RealVNC account. From now on, you can access it from any computer where the viewer is installed.

On your local computer, you should follow the usual procedure for installing the VNC-viewer package and launching the program. When you first start you will be prompted to enter your account; and the computers you registered will appear in your list of accounts. RealVNC is quite nifty and you'll get the hang of it quickly; but if you need to connect more than five computers, you will have to fork out.

Our response to Nomachine

Another solution for remote work is the use of nomachine protocols. They originate from proprietary software called NX. The protocol is open, which has led to the creation of a free version and an open source version: FreeNX. Currently the most popular version is called x2go. It's heavy compared to the compressed X protocol, so it might not work for you if you're using Wayland. In fact, many desktops are not supported or require workarounds. However, Mate is fully supported, and if it's your favorite, then look for its remote work package. For better performance, you can also use LXDE, which worked great for the author.

(1 ratings, average: 5,00 out of 5)

The other day I was presented with an old Compaq nc6120 laptop, an old man of course, but at one time I would have given a lot for such a computer. I added RAM to it, reinstalled Windows XP and installed the necessary SEO software on it. This laptop is all I need so that I have Windows XP and I can do things on it that I cannot do in Linux. But the laptop has a dead keyboard, and using two mice is not very convenient. And so I began to decide how to connect to Windows from Linux?


Prior to this, all programs that do not work under Linux i . But the virtual machine consumes a lot of resources and my laptop periodically freezes because of this. The ideal option now is to remotely connect to Windows and display its desktop on the main monitor. Then this old laptop can be shoved far away and connected to it remotely, via wifi, for example.

A few years ago I did such things and now you just need to remember everything. Where do we start?

How to set up remote desktop?

The simplest is to use a connection to a remote work Windows table. To do this, here (as in the picture) you must have a check mark and all services are enabled by default. To do this, right-click on MY COMPUTER and select PROPERTIES. Then go to the REMOTE SESSIONS tab. And check the box next to "Allow remote access to this computer".

After that, we need to make sure that our IP address is static, not dynamic. For this, first. We are looking for the RUN tab in the START menu and give the command cmd. Then in the terminal that appears, issue the command ipconfig.

My address, as you can see, is 192.168.1.6, you can make it static. To do this, go to network connections, and right-click on the WIRELESS NETWORK CONNECTION icon. Select PROPERTIES. In the window that appears, go to the GENERAL tab and select the TCP / IP protocol. Click on it and press the PROPERTIES button.

Now we remove the POINT from the item GET IP ADDRESS AUTOMATICALLY and rearrange it to USE THE NEXT IP ADDRESS. Next, we prescribe everything, as I have, considering only that your main IP address may be slightly different.

In case you can't see:

192.168.1.6 255.255.255.0 192.168.1.1 8.8.8.8 8.8.4.4

Another important point: you need to set a password for the admin user - most likely you have one and you work under it. If the password is already set, then you can skip this step. If not, we set a password, I won’t describe how to do it, it seems that it will not be difficult.

Everything, with Windows finished, it remains only to install the desired program in Linux. You can install the Vinagre program, although there are others. If it does not suit you, then open Synaptic and enter the word RDP in the search - the protocol of this service. You'll find a dozen other programs that do the same thing.

Well, we will install this program, Vinagre:

sudo apt-get install vinagre

After installation, go to the MENU - INTERNET - VIEW REMOTE DESKTOP. We start the program and enter everything that is needed: the ip address that we came up with before, the administrator login (admin) and the screen size.

Here, a window appeared, enter the password and get into Windows! Now you can work on two computers at once on one monitor. It is very similar, as when working on a virtual machine, only now nothing will hang for me :)

If you have Windows 7 or 8, then you can do the same. But I'm still sure that Microsoft, I don't even want to work with the rest for free.

And one more thing: in the program, you will notice that in addition to RDP, there are other protocols that you can use to connect to Windows - VNC and . These protocols are better than this one, but you need additional software in Windows to connect using them. I’ll even say more: you need to run a VNC or SSH server. I've done this before and know how to implement it. But I'll write about it some other time :)

Hey! Thanks for the site, it's great!
Good luck and development!

Thank you, we are trying!

The other day, I finally improved this system: the fact is that the connection sometimes slows down a lot, since everything goes through a wai file (and this is not the best speed) plus through a router. Since the router is far away, the brakes are constant.

I did this: I have an ordinary router, as I bought it a long time ago, I connected two laptops to them through ordinary network cards. On one put the address 192.168.0.1, and on the other 192.168.0.2 and both here and there the netmask is 255.255.255.0

Didn't write anything else. Now in remote connection I expose these addresses, the channel is 100 Mbit and everything works like clockwork.

Remote Linux desktop connection from Windows using Xming and SSH

Unlike Windows, in Linux, the graphical shell is not part of the system kernel. The standard windowing system for Linux is the X Window System, or simply X. It takes care of rendering graphical elements and interacting with input-output devices. And the most delicious thing is that this system has a transparent client-server architecture. The window system acts as a server, and graphical applications act as clients. As expected, clients connect to and interact with the server to render and receive mouse and keyboard events.

But that is not all! The fact is that the window system can be located on another computer, and the graphical application can communicate with it through the network. This way you can run the application on a remote computer, making it draw on the computer you are currently working on. Or vice versa. Or run the program on one remote computer and draw the interface on another remote computer.

1.SSH client. I installed PuTTY.

2.X Server for Windows. I chose Xming.

First, let's establish an SSH connection to a remote computer. To do this, launch PuTTY. Enter the IP address of the Linux computer

Now go to the Connection / SSH / X11 section and enable GUI redirection. As the location of the X server, we enter the IP address of the Windows computer we are currently sitting at (it will most likely be 127.0.0.1)

In addition, so that crocodile characters do not pop up instead of Russian letters, it is desirable to set the correct encoding in the Window / Translation section (I have UTF8 - the standard encoding on Debian and Ubuntu). We return to the Session section, save the settings and connect to the Linux computer. In case of successful connection, we enter the login and password and see the text console. With it, we can run console programs remotely, but graphical programs cannot be drawn in the console. Therefore, we will leave our connection via SSH for a while.

Now let's set up Xming. To do this, run the XLaunch program - this is the settings wizard. At the first step, we specify the method of integration into the Windows graphical environment. I like the first one the best, where each Linux application is in its own window.

In the second step, we are invited to automatically launch some application along with x. I preferred to do this later, as needed, with PuTTY already running.

In the third step, we specify the Xming launch options. The Clipboard option allows you to integrate the clipboard. Also, for a full-fledged work, I entered the following parameters:

-dpi 96? - to fix the font size. The value can be adjusted according to your taste.

"-xkblayout us, ru" - to work with two keyboard layouts.

"-xkbvariant basic, winkeys" - clarification of layouts.

"-xkboptions grp:caps_toggle" - toggle layout CAPS key LOCK.

And finally, in the next step, save the settings with the "Save configuration" button and start the X server with the "Finish" button.

The Xming icon will appear in the system tray.

So the X server is up and running. We return to our console provided by the SSH connection. Here we can remotely launch a console application, and in the same console we will see the output of this application. And what will happen now if we try to run a graphical application in this console? Usually, if you're SSHed in and try to run a windowed application, you'll get an error because you're connected to remote computer in console mode, and there is simply nothing to draw windows with. However, this time we have enabled graphics redirection on our Windows machine, which is already running its own X server. Therefore, if you try to run a windowed application in a remote console terminal, its window will be drawn as Windows computer. Try, for example, typing the following command:

$ gedit &

An ampersand at the end of the command indicates that the program should be run in the background so that the console is available for other actions while it is running.

July 28

Newer versions of Ubuntu already have a built-in VNC server. We will use it standard means. While understanding this issue, I had to read a decent number of forums. So, many users write that in the version of ubuntu 14.04 this focus does not work due to some internal subtleties of the kernel device. I didn’t go into this issue deeply ... in any case, if suddenly you are the happy owner of this particular version, you can use the alternative x11vnc server.

It is set up quite simply:

sudo apt-get remove vino sudo apt-get install x11vnc

In the same article, the standard VNC server is already included in ubuntu by default. How to set everything up?

Connect to a remote host.

We connect via ssh to the remote computer to which we want to get graphical access. At the same time, we must know his ip and login with the password of the user whose screen we want to see. In fact, the data of any user with sudo rights will do for us, but then we will have to adjust some points.

So, let's say on the local network we have a computer running ubuntu with ip address 10.20.0.30 and user feanor184 . We connect to it from the console with the -X key (to launch graphical X's):

Ssh-X [email protected]

enter the password and get into the console of our remote computer.

Now, enter in it:

sudo wine-preferences

and see the graphics window

Here we put the checkboxes:

allow other users to view your desktop — let's see the desktop.

allow other users to control your desktop — allow you to control the mouse and keyboard remotely.

require the user to enter this password — be sure to set a password to connect. You never know who climbs in our network

show notification area icon: always — always display the vnc icon at the top of the screen in the tray.

You can also set your own settings - my settings are described here)

We save the settings and disconnect from the remote host.

To connect to a configured computer, use any client with vnc support.

For example, Remmina is for Linux.

UltraVNC Viewer - for Windows.

I remind you once again that in order for the described connection settings to work, the remote computer must have ubuntu OS. Installing ubuntu is a separate topic that I would not like to focus on here, so we will skip this step. There are many manuals on the Internet on this topic.

What do we end up with?

We got the opportunity to connect to a remote computer under ubuntu and perform any operations on it as if we ourselves were sitting at its monitor

AND Vino. The general principle of operation: a secure SSH tunnel is created from a Windows computer to Ubuntu and a VNC connection (remote desktop) is created through it.

The article is divided into four parts:

  • Installing and activating SecureShellServer: sudo apt-get install openssh-server service ssh status ssh start/running, process 2006

    Checking if port 22 is open (the default port used by SSH):

    Netstat -tulpan | grep:22 tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -

    On Linux, to connect via SSH using local port forwarding, the following command is generally used

    Ssh -C -p -L<локальный_порт>:<адрес_машины>:<удаленный_порт>-l<пользователь>

    This means that any connection originating from the local computer (localhost) through the port<локальный_порт>will be redirected over the SSH tunnel to<удаленный_порт>remote machine.

    There is some confusion about which IPs to specify in And<адрес_машины>. If the computer is behind a router (NAT) then<адрес_машины>must be the internal ip address of the computer (for example, 10.0.0.5), and in external ip address of the router. If the computer connects directly to the Internet, then the addresses And<адрес_машины>will be the same.

    Summing up about tunneling, consider an example:

    ssh -l myuserid -L 7777:work:22 gate ssh -p 7777 localhost

    This command does the following: it creates a secure ssh connection to the gate machine under the user myuserid. At the same time, listening begins on the local (from which the connection was made) machine on port 7777. If a connection is established on this port (again from within the local machine itself), then this connection is tunneled into an ssh connection, reaches the gate machine, and a connection is made from it on the work machine on port 22. After that, we check the operation of the tunnel - by connecting via ssh to the local port 7777, we eventually connect to the work machine (taking into account that an ssh server is configured on it on port 22).

    Enhanced security when using an SSH tunnel is achieved due to the fact that only one port must be open to the outside (SSH) and the encrypted connection will only go through this port.
    Check if the folder exists on the server

    /home/<имя_пользователся>/.ssh

    /home/<имя_пользователся>/.ssh/authorized_keys

    in it, if not, then create under the user<имя_пользователся>(usually this is the first user on the system or an administrator)

    mkdir ~/.ssh cd ~/.ssh touch authorized_keys

    Setting up ssh for more security. The settings file is located at

    /etc/ssh/sshd_config

    Making a backup

    sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original

    In general, you should change:

    • TCP listening port (default 22):
      port<Порт_на_котором_SSH_будет_ждать_подключения>
    • Disable the untrusted old SSH ver.1 protocol:
      Protocol 2
    • Allow public/private key pair authentication:
      PubkeyAuthentication yes
    • Specify where to look at allowed public keys:
      AuthorizedKeysFile %h/.ssh/authorized_keys
    • Disable the ability to authenticate using a password (you can do it later, after a successful first connection):
      PasswordAuthentication no

    For greater security, you should configure SSH authentication with a public key.
    Public keys allowed to connect via ssh are stored in a file

    ~/.ssh/authorized_keys

    We generate a pair of public / private keys on the machine from which we will connect (to be described later) and copy the public key to this file.

    Particular attention should be paid to formatting - the entire key must be placed on one line and begin with "ssh-rsa" and file access (-rw——- (600)).

    We configure the correct access to the file with keys

    chmod go-w $HOME $HOME/.ssh chmod 600 $HOME/.ssh/authorized_key chown `whoami` $HOME/.ssh/authorized_keys

    In the settings file /etc/ssh/sshd_config change

    StrictModes no

    To apply the settings made in the file /etc/ssh/sshd_config, you need to restart the sshd daemon.

    sudo /etc/init.d/ssh restart

  • Download putty.exe
    Before diving into the Putty settings, there are a few things to note.
    • Putty saves settings to profiles.
    • To save all settings to a profile, go to the Session menu in the Saved Session column, enter the profile name and click Save. In order to load a specific profile in Putty, in the same menu, select the desired profile by name and click Load.
    • To automatically load a specific profile when you start Putty, you need to create a shortcut to the exe file and in the line Working folder add after the path to the exe file add
      -load<имя_профиля>

    To improve security will be used:

    • local port forwarding
    • public key system

    If you use an SSH connection for access via VNC (remote desktop), you must configure port forwarding, the so-called local port forwarding. It is used to increase security, since when using VNC, data is transmitted in clear text.

    To forward ports in Putty, go to the menu Connection -> SSH -> Tunnels and add 5900 as "Source port", localhost:5900 in "Destination" and click Add.

    You can use Puttygen to create a public/private key pair. Download puttygen.exe In the parameters, select SSH-2 RSA, set the number of bits to 2048 and click the Generate button.

    For additional security, you can write "passphrase" twice. If there is a need to immediately log into the console during an SSH connection, then the field can be left empty.

    The public key is stored in a format understandable only by Putty. Therefore, to install it on Linux, you need to do the following:

    1. While puttygen is still open, copy the public key in the section "Public key for pasting ..." And paste it into the file authorized_keys on server.
    2. Point Putty to the private key file in Connection -> SSH -> Auth menu under "Private key file for authentication" generated *.ppk file.
  • The Vino VNC server is already enabled by default in Ubuntu. To configure it, you need to go to Menu -> System -> Preferences -> Remote Desktop and enable remote access. In the settings, you can enable password authentication, but you cannot configure the listening port (5900 is used).
    For more detailed settings, it is recommended to install X11VNC.
  • Download TightVNC and install. For the purposes of this article, it is sufficient to select only the client role.

    We launch on Windows machine TightVNC and drive in the field