How do I SSH into a server in terminal?
“How can I connect to a remote machine or server and control it via a command line interface using SSH?”
-Question from Tom’s Hardware
SSH (Secure Shell) is a popular command-line interface protocol that allows for remote access. It enables you to gain access to and manage other computers remotely, transfer files, and do almost anything you can do while physically sitting in front of the machine.
How to SSH into a server from Linux/Mac/Windows
Next, we’ll see how to SSH into a server from different operating systems, including Linux, Mac, and Windows. Before that, let’s take a look at what you need to SSH into a server:
- The remote computer must always be online and turned on.
- The client and server software must be installed and made available. First, obtain the IP address or name of the remote computer to which you wish to connect.
- You must have the necessary authorization to access the remote computer.
- Remote connections must be permitted in firewall configurations.
Part 1. How to SSH into a server from Linux
UNIX-based operating systems like Linux include a built-in SSH command that works pretty much the same everywhere. Note that we use Ubuntu for this tutorial but these instructions would work with almost any Linux flavor. Let's see how to SSH into a server using Command Prompt.
Step 1. Open the terminal if you’re not already at the command line. Hitting CTRL + ALT + T does this or you can go to the apps menu and search for “terminal” to find its app.
Step 2. Type the following command into the terminal, replacing username with your username on the SSH server and ssh.server.com with the hostname or IP address of the SSH server:
Step 3. Type in “yes” if you are given a warning that the SSH connection’s key is not known. This may happen on first connection and you may need to reconnect after entering it.
Step 4. Enter your password if prompted. You won’t see the characters as you type them.
Step 5. Once you’ve verified your identity with your password, the screen will show any failed login attempts and the last time someone logged into your server. You’re logged into your server now successfully!
Step 6. To close your server connection, type in “logout” and press Enter.
Part 2. How to SSH into a server from Mac
If you’re a Mac user, follow the steps below to see how to SSH into a server using terminal Mac.
Step 1. On a Mac, go to Finder > Applications > Utilities > Terminal to open a terminal window.
Step 2. Again, type in the following command:
Step 3. The following steps are pretty much the same as we mentioned in Part 1. Please refer to the steps we mentioned above.
Part 3. How to SSH into a server from Windows
Finally, let’s see how to SSH into a server from Windows. Windows still lacks a built-in SSH command by default. As a result, the most popular and widely recommended solution for connecting to SSH servers is PuTTY, an open source, third-party application..
Step 1. Download PuTTY and launch it to get started.
Step 2. Enter the SSH server’s host name or IP address in the Host name (or IP address) box. Check that the port number in the Port box matches the port number required by the SSH server. To connect, click Open.
Step 3. You’ll see a security alert the first time you try to connect to a server. This tells you that you haven’t previously connected to this server. That’s expected, so click Yes to continue.
Step 4. You’ll be prompted to enter the username and password for your account on the SSH server. After you do, you’ll be connected.
Step 5. To end the SSH connection, just close the window.
Bonus tip: GUI remote access software for Windows PC
After learning how to SSH into a server from Linux, Mac, and Windows, you can use the commands to remotely control the server. However, for users who are not very skilled at commands, using SSH is a little bit challenging.
If you want a more intuitive and easy way to achieve remote control, we recommend you use the free remote support software AnyViewer. It provides you with a GUI experience, helping you achieve remote access with ease.
Step 1. Download, install, and launch AnyViewer on both your work and home computer. On the Controller computer, go to Log in, and then click Sign up. (If you already have signed up on its official website, you can log in directly.)
Step 2. Fill in the signup information.
Step 3. Then you can see you successfully logged in to AnyViewer. Your device will automatically be assigned to the account you’ve logged in to.
Step 4. Log in to the same AnyViewer account on the two devices, then you can achieve a direct connection by clicking One-click control to achieve unattended remote support.
Step 5. After connecting successfully, you’ll see the remote desktop. Then you can completely control it and provide remote support just like you’re sitting in front of it.
- You can also upgrade your account to a Professional or Enterprise plan. What can a professional or enterprise plan brings to you:
- More devices can be assigned to the same account for unattended remote support.
- Connect in privacy mode to protect privacy, which means the Controller can black the remote PC screen and disable the remote keyboard & mouse click.
- Faster file transfer speed. Transfer speed for a free account is 500 KB/s, and for a paid account is up to 10 MB/s.
The bottom line
This post primarily introduces how to SSHinto a server from Linux, Mac, and Windows. Although this post offers a stepwise tutorial, command lines still sound difficult to some users. At this time, you are advised to use AnyViewer, which provides you with a GUI experience, helping you remote into a server with ease.