How to Connect to a Linux or a Windows Server

Photo of author

By Vijay Singh Khatri

Organizations that support work from home, or are based in different locations, need to operate multiple machines at the same time. If accessing remote machines wasn’t easy, controlling remote computers from different locations would become complicated. There are several ways you can create a connection with a remote system based on the operating system you are running, but among the most common protocols, SSH (Secure Shell) and RDP (Remote Desktop Protocol) are the most used ones. Here we are going to show you how to connect to a remote server with Linux and Windows machines using these protocols.

Prerequisites to Connect to a Remote Server

SSH and RDP are for different machines. SSH is for Linux, and RDP is for Windows. You can use any of these protocols based on your operating system on your client-server app and create a remote connection with a remote machine. With these tools, you can obtain access to the remote machines and control them, transfer files, and do every other thing you could do if the remote machine was in front of you. However, before making a remote desktop protocol with a remote computer, you need to meet the following prerequisites.

  • The remote computer should be running during the time you want to connect with it.
  • It should be connected to the Internet.
  • The remote computer should have the client and server applications installed and allowed.
  • You should know the IP address of the remote machine you are trying to access.
  • You should have admin privileges to connect to the remote computer.
  • Make sure that the firewall settings on the computer allow a remote connection.

Now, as we said earlier, if you are trying to connect to a Linux server, you will require SSH, but in the case of a Windows server, you will need RDP. So, let’s get to know about each of these protocols one by one.

What is SSH?

A secure shell or secure socket shell is a protocol for remote device connection. It allows you to use text-based UI, and when you install an SSH connection, a shell session will start. Now you can use the local machine to type commands and control the remote computer. SSH is mostly used by the system and network admins, but anyone who needs to manage a computer remotely and safely can use the SSH protocol. To create a stable SSH connection, you will need a client and a server-side component. The client is a software program that you will have to install on your device, and it will allow you to link to another remote computer or a remote server. The client device will use the remote host information available to create the connection. It will need verified credentials to establish an encrypted connection between the remote and host devices. There is an SSH daemon component on the server-side that has a constant connection with a TCP/IP port that creates stable connection proposals. When the client begins to create a connection, the SSH daemon will come up with the compatible protocol and software versions, and the client and server will exchange the requested data with each other. If the verification of the credentials is accurate, then SSH will start a new request for the right environment. Now to enable an SSH connection, you will have to follow some instructions.

How to Allow an SSH Connection?

To create an SSH connection, you will require a client and a server component; the first thing you’ll need to do is install both of them on the local and remote computers. A commonly used SSH tool that is also open-source and supports Linux distributions is OpenSSH. You will have to install OpenSSH on your Linux machine, but you will have to use the terminal on the server and device that you want to use for a remote connection. However, a Linux distribution called Ubuntu does not come with an SSH server by default.

How to Install OpenSSH?

Some Linux distributions have a default SSH client and when you are trying to install one on your Linux machine, make sure it is not installed already. To know if your Linux distribution comes with OpenSSH or not, you will have to follow the steps below:

Step 1: Launch the SSH terminal by pressing Ctrl + Alt + T on your keyboard and type “terminal” on the blank box.

Step 2: Type SSH and press OK or hit the Enter button

Step 3: If OpenSSH is installed on your Linux computer, then it will deliver the following response:

username@host:~$ ssh

usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]

[-D [bind_address:]port] [-E log_file] [-e escape_char]

[-F configfile] [-I pkcs11] [-i identity_file]

[-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address] [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]

[user@]hostname [command]

username@host:~$

If this response shows up, then you can start to connect your local machine to the remote machine. But if the response is something different, then you can install the OpenSSH client using the steps given below:

Step 1: Run sudo apt-get install OpenSSH-client on your terminal.

Step 2: Enter your superuser password when instructed.

Step 3: Press Ok or press the Enter key, and the installation process will be done.

You can create an SSH connection with a remote machine using the server-side application. Make sure that you have access to the remote computer, such as its hostname and IP address. But to install the OpenSSH server, you will have to follow a different set of steps.

How to Install an OpenSSH Server?

Your local computer needs to have a server-side application to be able to accept an SSH connection. The server-side application is a part of the SSH software package. You can attempt to connect with the local host to find out if the SSH server is present on the Linux system or the remote machine that you want to accept the SSH connections from. Here are the steps that will help you find out if the OpenSSH server is unrestricted on the Ubuntu computer:

Step 1: On your server machine, launch the terminal feature by pressing Ctrl + Alt + T together and writing “terminal” on the blank box.

Step 2: Enter ssh localhost on the blank field and press OK or press the Enter button on your keyboard.

Step 3: If your system does not come with an SSH server, then it will deliver the following response:

username@host:~$ ssh localhost

ssh: connect to host localhost port 22: Connection refused username@host:~$

If the response shows up, then you can install the OpenSSH server from the terminal itself:

Step 1: Run: sudo apt-get install OpenSSH-server ii, and it will install the SSH server

Step 2: They will ask you to enter your superuser password, do so

Step 3: A disk space prompt will appear, and you will have to press Y or Enter key to continue the installation.

Your system will install the needed support file, which will help you understand if the SSH server is active on your remote machine. And for that, you will have to type the following command:

sudo service ssh status

If the SSH server is running the way it should, then it will deliver the following response:

username@host:-$ sudo service ssh status

  • ssh.service – OpenBSD Secure Shell server

Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab

Active: active (running) since Fr 2018-03-12 10:53:44 CET; 1min 22s ago Process: 1174 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCES

Main PID: 3165 (sshd)

You can alternatively run the ssh localhost command on your terminal prompt to see if the OpenSSH server is installed and enabled to accept connections. The response that it delivers will look like this:

username@host:~$ ssh localhost

The authenticity of host ‘localhost (127.0.0.1)’ can’t be established. ECDSA key fingerprint is SHA256:9jqmhko9Yo1EQAS1QeNy9xKceHFG5F8W6kp7EX9U3Rs. Are you certain you would like to restart connecting (yes/no)? yes

Warning: Eternally added ‘localhost’ (ECDSA) to the index of available hosts.

username@host:~$

Now you can tap on Yes or press the Y key to continue setting up your SSH server or allow it to accept SSH connection requests from a remote computer with an SSH client. You can also edit the SSH daemon configuration file from the terminal port using this command:

sudo nano /etc/ssh/sshd_config

You can choose your ideal editor to open the configuration file. But note that every time you modify the SSH configuration file, you will have to restart the service. And to restart SSH, you should run this command:

sudo service ssh restart

Once you are done installing the SSH server, the next step will be for you to learn how to attach your remote and local computer using the SSH portal.

How to Tie Your Remote Device via SSH?

Now that you have installed both the OpenSSH client and server on both your local and remote machines, you can use them to make an established connection between the devices with your servers. Here are the ways that you need to follow to create a connection between two devices:

Step 1: Launch the SSH terminal on the local machine and run the ssh your_username@host_ip_address command. It will show you a username that must match the username on the server you are attempting to remotely connect to. If the usernames match, type ssh host_ip_address and press the Enter key.

Step 2: Type your password and hit the Enter key again. Please note that you won’t be able to see your password on the screen while typing. So, if you are pasting the password, make sure it is correct.

Step 3: When you try to connect to a server for the first time, you will have to press Enter or Yes if asked whether you want to continue the connection. This confirmation will only appear once because the remote server is not known to the local computer.

Step 4: The previous step will add an ECDSA key fingerprint to your local machine that helps you stay connected to the remote computer.

You can use the private IP address rather than the public IP address when the local and remote computers are connected to the same network. Also, make sure that the TCP port is correct, and the settings or configuration for the port forwarding requests are correct as well. The default port of TCP is 22 if you have not modified the sshd_config file. This is all about SSH connection on a Linux system, but if you are running Windows, then you will have to know about RDP.

What is RDP?

RDP refers to a remote desktop protocol that was built by Microsoft and helps you manage and control computers that have the Windows operating system installed. You can monitor your Windows remote device using your local device with the help of RDP. However, the SSH client creates connections using the command line interface, but RDP provides the users with a graphical interface that you can use to access the control of the remote computer with your local computer. RDP services are also known as terminal services that allow you to manipulate your remote machines that are connected to your local network. However, to connect your computers with RDP, you need a VPN connection; otherwise, the remote connection will be less secure than that of an SSH connection. RDP is less secure than SSH because, with RDP, you are connected to different devices through the Internet directly. There are many hackers always waiting for a vulnerability in your connection, and Windows remote desktop connection uses open ports that are easy to hack. But when you are connected with a VPN, your connection is going through a private virtual outlet which creates a secure doorway for data transactions between your local and remote computers. You can also and must use strong, secure passwords and keep them updated regularly which will make your RDP connections less vulnerable to hackers.

How Does RDP Protocol Work?

An RDP connection is created using a straightforward client-server method with the remote desktop protocol. When you enable the RDP protocol, the Windows remote desktop server-side feature will start accepting the connection requests from port 3389. Every time you attempt to connect to a Windows Server, they will ask for the correct user credentials that will help you with remote access. After getting access to the server, you can manage the apps and transfer files between the local and remote machines. You can also create and complete any task on your local computer that is virtually connected to the remote computer. Regardless of the version of Windows you are running, you can easily create a secure connection with your local and remote computers using RDP. The Remote desktop client is present on Windows by default; however, you can only access a remote computer when the local computer has a server edition of Pro or Enterprise of the Windows OS. So you can only create remote connections between two devices with a premium Windows operating system installed on them.

How to Enable RDP Connection?

First, you will have to allow the Windows remote desktop server service on your computer, which is already integrated into your Windows system. An RDP client does not require any additional setup to allow you to connect to another remote computer that is running a Windows operating system. However, your Windows computer does not automatically accept RDP connection requests. And that’s why if you want to connect your computer with a remote server through the network and if it is not your local network, then you will have to keep a few things in mind when you are enabling the RDP connection:

There are three ways you can enable the RDP connection on your remote desktop: port forwarding, using a VPN connection, and turning off the firewall settings.

Port Forwarding

You need to ensure that the ports are forwarded to the right remote host’s IP address safely without being compromised. You can also check out the router’s settings to find out if the traffic on the TCP port for RDP or port 3389 is going through the remote desktop’s IP address. In this method, your remote Windows server is exposed to the network and available for hackers to hack.

Employing a VPN

Using a virtual private network on your client machine will help you access the remote services from your local connection. When the data is being transacted through a private, secured tunnel, there is no need for you to be worried about unsecured remote connections.

Firewall Settings

If the firewall on your system is blocking your remote connection, then you won’t be able to connect your remote desktop with your local computer to virtually access its files. You have to configure your firewall to allow it to accept the local port for RDP regardless if it’s a custom port number or a default port number.

When you are considering these points, you can easily connect your local computer with the remote server. Follow the section below to understand how to enable remote access in various Windows Server versions.

How to Enable Remote Access in Windows Server Versions?

The method for configuring the remote desktop and enabling secure remote connections for a remote PC from a local PC is identical in all Windows OS versions. In this section, we are going to give you a step-by-step process to help you to create remote access to your desired computer. However, before you proceed with the steps, make sure that you have considered the port forwarding, VPN, and Firewall setting that we have discussed in the section before.

Step 1: Allow Remote Connections

Open the control panel on the machine where you want to enable remote connection, and then follow the steps below:

Step 1: Right-click on Computer or This PC according to your OS version

Step 2: Click on Properties

Step 3: Click on Remote Settings from the left side of the menu

Step 4: Select Allow remote connections to this computer. This step will automatically take down Remote Desktop from the firewall list. And you can also unselect the box that reads, “Allow connections only from computers running Remote Desktop with Network Level Authentication (recommended)”

Step 5: Lastly, click on Apply or OK.

Step 2: Add Users to the Remote Users List (Optional)

This step is only useful if you want to allow other users than yourself or the administrator to access the remote computer. Administrators are already included in the list of allowed users, but you will not find them in the list. If you want to add additional users to the list, then follow the steps below:

Step 1: Click on Select Users from the Remote settings screen

Step 2: Click on Add from the Remote Desktop Users box

Step 3: Here, you will see the Select Users box. You can also pick the location where you want to search for users by clicking on Locations.

Step 4: An Enter the Object Names to Select space will appear where you will have to provide the name of the user and click on Check Names

Step 5: When you find the user, click on their account and click on OK

Step 6: Now click on Close or OK to exit the window

These are the options that allow you to configure your remote desktop client, and you can easily connect your local computer to the remote computer as you wish.

How to Use a Remote Desktop Connection Client?

You won’t have to configure the remote desktop client on your local computer to use it, and the steps that we are going to share below apply to all versions of the Windows operating system.

Step 1: Open the Desktop Connection Client

  1. Hit the Start button and search for Windows accessories and click on the folder. The Remote Desktop client will open up.
  2. Hit the Start button again and type Remote desktop Connection in the search area. Search results will come up as soon as you enter the keyword. Click on the right application from the result.
  3. Or press the Windows + R keys together to open the run box and enter the Remote Desktop client in the search field to run the desktop app.

Step 2: Enter the IP Address or Host Name

A window will appear in the Remote Desktop Connection app where you can enter the hostname or the IP address of your remote machine. The Computer field will be empty when you have to enter the correct IP address and then click on Connect. You can enter the private or public IP address of the remote computer depending on certain situations:

  • You will have to provide the private IP address for the remote connection if the remote computer is connected to the same Local Area Network
  • If you are using a VPN connection, then you will have to provide a private IP address
  • But if you are connecting the remote computer with your local computer over a different network and you are not using a VPN, then you will have to provide a public IP address.

Step 3: Enter the RDP Credentials and Create a Connection

After clicking on the connect button, you will find a bar that displays the progression of the process, and when the configuration of the remote access is finished, you will find a pop-up window on your screen. Here you will have to do the following:

Step 1: Provide the password for the username or provide a different user credential

Step 2: Click on OK, and they will send you a warning message

Step 3: Click on Yes

That’s how you create a connection with your remote desktop from a local desktop. And you will be able to observe the actions of your remote computer from your local desktop only.

Conclusion

While you are connecting your local computer to the remote computer, please consider this point that only one user can access the remote machine or a Windows machine at the same time. If someone else is using the remote computer that you are trying to access, then that user has to disconnect for you to allow access to the remote machine. But always remember to access a remote desktop safely by using a VPN connection and third-party multiple authentication tools. This post will help you understand how to connect the server to a Linux or Windows machine using different connection methods, but if you have any questions, feel free to ask us in the comment box below, and we are always ready to help.

Leave a Comment