Pair Networks Blog How To,Web Hosting Securely Connecting to Your Web Server Using SSH

Securely Connecting to Your Web Server Using SSH

Securely Connecting to Your Web Server Using SSH post thumbnail image

Connect to Your Server with SSH Header image

What is SSH?

SSH (Secure Shell) is a terminal program that allows you to securely connect to another machine – in this case,  your server. This connection gives you the ability to manage your server from your local computer. SSH is a tool that gives you extra functionality that is not always included in your control center. While SSH may appear daunting at first, it is a necessity for getting the most out of your hosting account.

Using SSH

So you want to learn how to SSH? Great! First, we have to set you up with a way to use SSH on your operating system. If you have a Windows machine, go to Using SSH on Windows. If you have a Mac OS X, Linux, or other Unix-like operating systems, go to Using SSH on Mac OS X, Linux, or other Unix-like Operating Systems.

Using SSH on Windows

Windows systems don’t have a built-in SSH client. In order to use SSH on a Windows computer, you will have to download one. We recommend using PUTTY, which is free, or SecureCRT.

Once you have downloaded an SSH client, like PUTTY, you will need to connect to your server. How you would do this in PUTTY would be to open the program, enter your hostname, and click Open. If this is your first time connecting, you may get a warning asking if you trust the server. Just click Yes to continue. This will take you to a terminal like interface. Here you will see a Login As command. Type in your ACC account username and hit Enter.

It will then ask you for your password. Input your ACC account’s password here and hit Enter. Note that it won’t show anything as you type your password. This is for security purposes. Don’t worry. It’s registering all your keystrokes; they’re just not being displayed. If you messed it up, it’s okay. Just try again until you get it.

Once you get it, you’ll be logged in to the server. Once you’ve done this, you can navigate around and manage your server with the SSH commands that are listed later in this post. Just type them into the terminal interface and hit Enter.

Using SSH on Mac OS X, Linux, or Other Unix-like Operating System

On the Mac OS X, Linux, or other Unix-like operating systems, an SSH client is built into the terminal. To use SSH on these machines, simply open a terminal program, such as Terminal, Gnome Terminal, konsol, or xterm. Once you have a terminal program open, you can login to your server.

Logging in to your server requires you to know your hostname. It would appear something like this:

ssh [email protected]

For example, a pair Networks hostname would be:

ssh [email protected]

pair networks hostname example image

Once you enter the hostname, you will be asked for your account’s password. In a pair Network customer’s case, this would be the same password to log you into the Account Control Center. Once you have entered this, you will be entered into your server.

Navigating with SSH Header Image

Navigating Your Server with SSH

Once you’ve logged in to your server, you can move around your server’s files and directories by using SSH commands.

The three most useful commands for navigating are the following:

ls Lists contents of current directory
cd <directory or path> Move to that directory or path.
cd .. Move back one directory or folder

The command ls will cause the terminal to list out the contents of the directory you are currently in. This is useful for when you’re trying to orient yourself in the server. So when you enter a directory and want to know what’s there, you can use ls to see where you need to navigate next or if the file you are looking for is there.

The cd command is followed by the name of where you want to go. If you are entering a directory that shows up when you use the ls command, you need only write cd directoryname in order to navigate into it. If you are navigating to a directory that is not immediately shown when using the ls command, the file or directory is not in the directory you are in currently. This means that you must enter the file path in order to navigate there all at once. If you don’t know the file path, you can search around your directories by using cd and ls.

If you want to back up to earlier directories, you can use cd .. to return to the last directory you were in.

With these three commands, you can effectively explore your entire server and familiarize yourself with its setup. Now, once you have mastered SSH navigation, you can use them in conjunction with the rest of the SSH commands.

Basic SSH Commands

You can move files and directories around, create copies, make and delete, and even edit them.

 

cp <file> Copy file to destination.
cp -r <directory> Copy directory or destination.
mv <file> Move file to destination.
mkdir Make new directory.
rm <file> Delete file.
rm -r <directory> Delete directory (Note: this will also delete everything inside the directory, too).
killall <program> Stop (or kill) all running processes of the program.
pico <file> Opens file in terminal’s file editor.

Each command is executed when you hit the Enter key in the terminal. With these commands, you can begin to manage your server’s files and directories.

Graphical SSH Clients

If using these types of commands is not your cup of tea, you can also install a graphical SSH client on your computer. These programs give you a more intuitive interface than the terminal. To use graphical SSH clients, you will have to input your server information before connecting. If you’re a pair Networks customer, you can find all the needed information in the ACC. If asked for your terminal type, use “VT100.”

Going Forward with SSH header image

Going Forward with SSH

Whether you’re using the terminal or a graphical client, SSH can take you to the next step in server functionality. It’s always a good idea to have a backup of your directories or files, so you can explore the SSH commands without fear of making a critical error.

Once you have mastered these basic commands, you can move on to more complex SSH commands, like creating SSH keys. Stay tuned for the next blog post in this series, which will teach you about SSH keys and how to use them, by subscribing to the blog.  

 

 

 

Related Post