Connect to windows computer from linux

Connecting to Windows Networks Shares from Ubuntu Desktop

Remote users can connect over the network and access shared files and folders as if they were directly connected to the local machines. This is a convenient way to make files and folders available to other people on your local network.

This brief tutorial is going to show students and new users how to access Windows network shares from Ubuntu desktops. When you open Ubuntu file manager, it should find network shares that are automatically advertise across the network.

Ubuntu and other desktop computers should be able to view and connect to the shares… however, if the shares are not advertised, you will need to connect to the shares manually by typing the resource network address. To get started with access Windows shares across the network, follow the guide below:

Access Windows Shares

To browse Windows files over the network, open the Files application from the Activities overview (top left corner) or click File Manager on the dock and click Other Locations in the sidebar.

Connect to a file server

To connect to Windows shares, use the guide below:

In the file manager, click Other Locations in the sidebar.

In Connect to Server , enter the address of the server, in the form of a URL . Details on supported URLs are listed below .

If you have connected to the server before, you can click on it in the Recent Servers list.

Then click the Click Connect button . The files on the server will be shown. You can browse the files just as you would for those on your own computer. The server will also be added to the sidebar so you can access it quickly in the future.

Windows computers use a proprietary protocol to share files over a local area network. Computers on a Windows network are sometimes grouped into domains for organization and to better control access. If you have the right permissions on the remote computer, you can connect to a Windows share from the file manager.

A typical Windows share URL looks like this:

This how to connect to Windows shares from Ubuntu.

Ethical hacking and penetration testing

InfoSec, IT, Kali Linux, BlackArch

How to connect to Windows remote desktop from Linux

RDP (Remote Desktop Protocol) clients exist for many platforms, even for mobile phones, of course, there are RDP clients for Linux as well

We will look at 2 RDP clients for Linux

  • freerdp is a free implementation of the Remote Desktop Protocol (RDP)
  • rdesktop is an open source client for remote desktop windows services

How to use freerdp

To install freerdp on Debian, Kali Linux, Linux Mint, Ubuntu and derivatives, run the command:

If the freerdp2-x11 and freerdp2-shadow-x11 packages are not found, look for a package named freerdp.

To install freerdp on Arch Linux and derivatives, run the command:

How to connect with freerdp command

To connect to the remote desktop using xfreerdp, run a command of the form:

In this command:

  • /f is option means to open the remote desktop in full screen mode
  • /u:USERNAME is a name of the account on the computer to which we are connecting
  • /p:PASSWORD is a password of the specified account
  • /v:HOST[:PORT] is an IP address or name of the computer to which the remote table is connected. PORT optional (recommended: “Windows Computer name: how to change and use”)

For example, I want to open a remote computer desktop with IP address 192.168.0.101, on which there is a Tester user with a password of 1234, and I want to open a remote working collision in full screen mode, then the command is as follows:

To toggle between full-screen and windowed modes, use the keyboard shortcut Ctrl+Alt+Enter.

When connecting for the first time, the following message about the problem with the certificate appears:

Since self-signed certificates are used without a private CA (authentication center, certification authority) added to the store, the only choice is to agree to trust the specified certificate, enter Y for this.

In full screen mode, you can disconnect from the remote desktop in two ways:

  • press the cross on the top panel
  • Start button → Shutdown → Disconnect
Читайте также:  Все версии viber для windows phone

To run in windowed mode, do not use the /f option:

Xfreerdp options

The xfreerdp program has many options,I picked up the most interesting of them:

How to create shared folders in freerdp

With remote desktop connected via RDP, you can have shared folders. Let’s look at a few examples.

To connect all mount points in the current system as shared folders on the remote desktop, use the +drives option, for example:

The screenshot shows the remote Windows desktop, in which the Linux system folders are accessible:

To connect only the home folder of the current Linux user as a network folder to the computer via RDP, specify the +home-drive option:

In this case, the home folder is mounted on a system connected via the remote desktop protocol:

With the option /drive:NAME,/PATH/IN/LINUX, you can connect any folder with any name. The path in the current system must be specified as /PATH/IN/LINUX, and NAME is the name that will have the share in the remote system. For example, to connect the root folder of the current system (/) to the remote folder with the root name:

How to bring remote desktop to another monitor

If you have several monitors, then you can choose which one to use for the remote system. To list the monitors, run the command:

Select the monitor (or multiple monitors) identifier using the /monitors: [,[,…]] option.

How to set the size of the remote desktop window

The following example connects to the rdp.contoso.com host with the name USER and is 50 percent of the height.

If width (w) is set instead of height (h), something like /size:50%w, then 50 percent of the width will be used.

How to use rdesktop

To install rdesktop on Debian, Kali Linux, Linux Mint, Ubuntu and derivatives, run the command:

To install rdesktop on Arch Linux and derivatives, run the command:

How to connect to remote desktop with rdesktop

To connect to RDP with rdesktop, use a command of the form:

As usual, at the very beginning there will be a problem with the certificate:

We type yes.

Then an error will occur:

This is because network-level authentication (Kerberos TGT) is not configured. Setup instructions at: https://github.com/rdesktop/rdesktop/wiki/Network-Level-Authentication-(NLA)

Another option that allows you to connect to Windows via RDP using rdesktop without setting up Network Level Authentication (NLA) is to disable network-level authentication in Windows. It is clear that this will weaken the security of RDP, therefore it is not recommended. But as a “quick dirty fix” this can be done as follows: Start menu → Settings → System → Remote Desktop → Advanced settings → Uncheck “Require computers to use Network Level Authentication at the to connect (recommended)”:

After that, rdesktop connection passes without errors:

In the Windows settings, you could see the link “Why allow connections with Network Level Authentication?”, It says the following:

If you want to restrict who can access your PC, choose to allow access only with Network Level Authentication (NLA). When you enable this option, users have to authenticate themselves to the network before they can connect to your PC. Allowing connections only from computers running Remote Desktop with NLA is a more secure authentication method that can help protect your computer from malicious users and software. To learn more about NLA and Remote Desktop, check out Configure NLA for RDS Connections. If you’re remotely connecting to a PC on your home network from outside of that network, don’t select this option.

How to connect from Linux to another Linux via RDP

There are no special features when connecting using the xfreerdp program, it is enough to start the RDP server, and if you use freerdp-shadow, then the /sam-file:SAM /sec:nla options are also needed:

Or run xrdp-sesman and xrdp as an RDP server.

And then the connection to Linux via RDP is the same as to Windows:

As for rdesktop, it could not be forced to work with any of the RDP servers under consideration under Linux – if you know how to do this, then write in the comments.

Remote Desktop Connection to Windows from Linux using RDP clients

Have you seen the ad that should be here?

Have you ever used the Windows app Remote Desktop Connection? This app, included in all Windows installations, allows you to remotely access another Windows PC or a server with Windows Server. For this purpose, it employs the Remote Desktop Protocol (RDP).

Organizations can install applications on a central server instead of various computers. To use those applications, employees must remotely access that server. Such centralization can make maintenance and troubleshooting easier. This technology was formerly known as Terminal Services (TS). Currently, web systems are more common. But, in some scenarios, Windows remote apps are still needed.

Читайте также:  Как убрать спящий режим linux

In those scenarios, Linux users can remotely access Windows computers and servers from their favorite system using an RDP client.

There are a few RDP clients available for Linux and we are going to talk about them today:

You can choose the one you like best or the one that best suits your needs.

Out of curiosity, FreeRDP is both an app and a library, which provides reusable features for other apps. Except for rdesktop, all of the other clients above use the FreeRDP library.

Enabling remote desktop on Windows

First of all, you must set up the computer you want to connect to so it allows remote connections. On the Windows machine you want to connect to, logged on with an administrator account, open the Start menu and click Settings. To do that, on the window that appears, open the System category, and then Remote Desktop. Finally, enable it:

Note that you can’t connect to computers running a Windows Home edition (for instance, Windows 10 Home). This screen informs you, if that is the case:

Your Home edition of Windows 10 doesn’t support Remote Desktop.

Source of the image: Digital Citizen

If you want more information about remote desktop on Windows, take a look at:

Remmina

Remmina is a remote desktop client that supports many remote access protocols such as RDP, VNC, NX, XDMCP and SSH. It aims to be useful for system administrators and travellers, who need to work with lots of remote desktops and/or servers. Remmina is included in the Ubuntu Linux distribution and is its default remote desktop client.

To install Remmina on Linux Kamarada and openSUSE, run:

Once installed, to start Remmina, if you use the GNOME desktop environment, open the Activities menu, on the top-left screen corner, type remmina and click its icon:

To quickly start a remote access, select the RDP protocol, type the hostname or IP address of the computer you want to connect to (e.g. 10.0.0.251 ) and hit Enter:

If it’s the first time you connect to this computer, Remmina asks whether to trust its certificate, click Yes:

On the next screen, enter your User name and Password on the remote computer. Also inform the Domain, if necessary. Optionally, you can choose to Save password. Click OK:

You will see the remote computer’s desktop in the Remmina window:

From now on, you are using that computer, but remotely, without sitting in front of it. Each clicking and typing is sent to be processed on the remote computer.

If the remote computer is a Windows desktop, its screen is locked during remote access.

If you are going to access this computer often, consider saving the connection settings, so that remote access can be easily initiated. To do this, click the Create a new connection profile button on the top-left corner of the Remmina main window:

On the next screen, give a Name to identify the connection, select RDP in the Protocol field and enter the connection settings: Server, User name, User password and Domain (if necessary). When you’re finished, click Save:

After that, the connection becomes listed on the Remmina main window:

When you want to remotely access that computer, just double-click it on the list.

FreeRDP

FreeRDP is a free implementation of the Remote Desktop Protocol following the Microsoft Open Specifications. This implementation provides both the client and the server applications as well as a library, which allows other applications to use the RDP protocol. Today, we are interested in the FreeRDP client application.

To install the FreeRDP client on Linux Kamarada and openSUSE, run:

The FreeRDP client does not have a main screen like Remmina. To start a remote access using the FreeRDP client, run this command from a terminal:

Making the appropriate substitutions. For example:

If you need to inform the computer’s domain, use the /d parameter:

If it’s the first time you connect to this computer, the FreeRDP client asks whether to trust its certificate:

Type Y (yes) and hit Enter. Then type your user password on the remote computer and hit Enter:

After that, the remote desktop connection is initiated:

If you have ever started the remote desktop connection on Windows by the Command Prompt (using the mstsc command), you may have noticed that the FreeRDP client uses the same command syntax. It was implemented that way on purpose, to keep compatibility.

If you are a curious person and want to check it out by yourself:

Читайте также:  Как включить защиту глаз windows 10

rdesktop

rdesktop was the first RDP client for Linux and, for many years, it was the most used. But since November 2019, the project is looking for a new maintainer.

In contrast, FreeRDP was born in 2009 as a fork of rdesktop, when Microsoft decided to open the RDP specifications. As time passed and the FreeRDP project evolved, it became the standard RDP client on systems where no native Microsoft client is available.

I present rdesktop here for information purposes only. Unless you have a good reason to use it, you are advised to use one of the other RDP clients, based on FreeRDP.

To install rdesktop on Linux Kamarada and openSUSE, run:

Then, to start a remote access using rdesktop, invoke it from a terminal followed by the hostname or IP address of the computer you want to connect to. For example:

In the past, that would suffice and rdesktop would just work. But now we face a problem that comes from the lack of proper maintenance and updates:

At some point, Microsoft released an Windows update that has since made the use of Network Level Authentication (NLA) required by default. FreeRDP does support NLA, while rdesktop does not. You can still use rdesktop for remote access, as long as you disable NLA on the computer you want to connect to. Note that this makes the connection less secure.

To disable NLA on the Windows machine you want to connect to, logged on with an administrator account, open the Control Panel, open the System and Security category, then click the System icon. On the next screen, click the Remote settings link by the left. On the dialog box that appears, select the Remote tab. Finally, disable the option Allow connections only from computers running Remote Desktop with Network Level Authentication and click OK:

With NLA disabled, back to the Linux computer that will start the remote access, try again:

This time, rdesktop will work. A window presents the Windows logon screen. Enter your username and password and press Enter to start the remote access:

If you want more information about that rdesktop bug, see:

Vinagre

Vinagre is the default remote desktop client for the GNOME desktop. That’s why it is also the default remote desktop client for Linux Kamarada 15.1, the current stable release. Like Remmina, it supports some connection protocols: SSH, RDP, SPICE and VNC. However, like rdesktop, Vinagre is unmaintained for some time now.

When trying a RDP access, Vinagre only displays a black screen, as I reported on the openSUSE mailing list some time ago:

On some distributions, like Debian, Vinagre works. I believe that those distributions applied some patch to Vinagre.

Probably, the next Linux Kamarada release will come with Remmina instead of Vinagre, following the Ubuntu Linux distribution.

Because of that, I present Vinagre here just for information purposes as well.

Vinagre comes already installed by default on Linux Kamarada and openSUSE, if you chose the GNOME desktop, but if you need or want to install it, you can do this by running:

To start Vinagre, which appears as Remote Desktop Viewer on the applications list, open the Activities menu, on the top-left screen corner, type remote or vinagre and click the corresponding icon:

On the Vinagre main screen, click Connect:

Fill in the next screen fields with the connection settings:

  • on the Protocol field, select RDP;
  • on the Host field, enter the hostname or IP address of the computer to connect to;
  • enter your Username on the remote computer; and
  • enter the Domain, if necessary.

When you are finished, click Connect.

If it’s the first time you connect to this computer, Vinagre asks whether to trust its certificate:

Tell it to do so by clicking Connect.

Enter your Password, optionally enable Remember this credential and click Authenticate:

At this point, you should see the remote computer’s desktop. You can notice it has its screen locked (as it normally does during RDP accesses). But, as I said, Vinagre only displays a black screen:

Like Remmina, Vinagre allows you to memorize the connection settings, to easily connect to the same computer again in the future. To do this, during the remote access, open the Bookmarks menu and click Add Bookmark.

After you created the bookmark, it will now be listed on the Bookmarks menu. When you want to remotely access this computer again, just open this menu and click the bookmark.

References

Since it’s not possible to remotely access computers running Windows 10 Home, to write this how-to I used a VirtualBox virtual machine with a Windows 10 Enterprise evaluation version legally downloaded from:

Оцените статью