New User Tutorial: Basic SSH Usage

Reading Time: 3 minutes

If you have an account on a cPanel server with shell access or your own VPS server or Dedicated server running Linux then SSH is a powerful tool to have in your skill set.

SSH (aka Secure Shell) is a way of logging into your server from a remote computer such as your home desktop or laptop. The remote connection utilizes encryption on both the server’s end and your end to keep the entire session secure.

The most common type of connection that our support department uses is to SSH into a server as the root user. Logging in as root allows you to make system wide changes, restart important services, and perform many other tasks that only the root user is allowed to do (by default).

If you are going to initiate your remote connection from a Linux or Mac OS X computer you can start using SSH by opening up the Terminal application. Linux users should know how to find the terminal, and Mac OS X users need only open their Applications folder and then the Utilities folder to find Terminal.app. Unfortunately SSH is not built-in to Windows, so you will need to download an application like PuTTY.

Once your terminal is open you can start your SSH session as root using the following command:

ssh root@host.servername.com
(where host.servername.com is your server’s name)

These commands tell your computer “I want to open a new SSH session to the server called host.servername.com, and I want to log in as the user root.”

If this is your first time connecting to the server using this hostname your SSH client will ask if you are sure you want to connect to a new, previously unknown host. Say “yes” and you will be prompted for the root account’s password (or simply, root password). After you have typed in the password and it is accepted you will be logged in to the server as the root user.

Before you continue, it is important to note that logging in to a server as root is a powerful but also potentially DANGEROUS system administration tool. The root user is allowed to change/delete practically everything in a server without any type of warning or confirmation of changes being made. Always backup your files before you modify them using a simple backup command:

root@host [~]# cp file file.bak

For new shell users, the above command breaks down like so:

  • root@host [~]#
    • The prompt. Shows you your username (root) and the name of the server you are logged into (@host). For example: If you were logged into a server called webstuff1 and your username was bill, your prompt might display bill@webstuff1.
    • The [~]# indicates the directory you are currently looking at/working in ([~] meaning home) and the end of the prompt (# indicating you are logged in as a superuser).
  • cp
    • The copy command tells the server to copy the file to a new file with a different name, or the same name but to a different location (path).
  • file
    • The file that you want to back up.
  • file.bak
    • The new copy of the file that will be created. You can also specify a new location like /home/username/file.bak
  • To review, the above command creates a copy of “file” in the same location as the original and calls it “file.bak”.

If this is your first time using a shell interface, be sure to check out part two of the New User Tutorial series: Basic Shell Commands.

You can also setup SSH keys for easier authentication, restart some services from the command line, change the SSH port to a different port number, learn how to use pipes to send the output from one command to another command, or even tell SSH to stop allowing the root user to connect.
===

Liquid Web’s Heroic Support is always available to assist customers with this or any other issue. If you need our assistance please contact us:
Toll Free 1.800.580.4985
International 517.322.0434
support@liquidweb.com
https://my.liquidweb.com/

Avatar for Jay Allen

About the Author: Jay Allen

Latest Articles

Blocking IP or whitelisting IP addresses with UFW

Read Article

CentOS Linux 7 end of life migrations

Read Article

Use ChatGPT to diagnose and resolve server issues

Read Article

What is SDDC VMware?

Read Article

Best authentication practices for email senders

Read Article