User Guide - Connecting to your Virtual Private Server using SSH


Applicable Plans: All eApps General VPS Plans.

User Guide – SSH User Guide

SSH or Secure Shell is a network protocol that allows the data between two devices to be sent over a secure channel. SSH was created as a replacement for Telnet and other insecure remote shells, which send all information (including passwords) in clear text, and can be intercepted and read by a third party.

Overview

All eApps VPSs have SSH installed as part of the default OS template. This is not an added service, but an integral part of your eApps Hosting account. Becoming familiar with SSH and the Linux command line can save you hours of time in managing your VPS. While there are many things that can only be done from the Control Panel, a great number of things can be done via SSH. You can edit configuration files, copy files from one location to another, and stop and restart services using SSH and the command line much faster than those actions can be done through the Control Panel.

Installing SSH
Using SSH
A Warning
SSH Clients
Windows SSH Clients
Mac OS X SSH Clients
Linux SSH Clients
Parallels Business Automation - Control Panel
How to Connect with SSH
SSH Users
Adding or modifying users
Linux Commands
Links to other information

Installing SSH

SSH is installed by default on your VPS, because it is part of the OS template used to build the VPS when the order is placed. There is no need to install SSH, and no need to ask for SSH access to be granted to your VPS. It is part of the standard setup.


Using SSH

SSH is a very powerful tool that allows you to directly access the command line of your VPS. This will allow you to execute Linux commands to control your VPS and manipulate files and directories and applications.

SSH can do far more than what is covered in this User Guide. There are many online resources and several books available if you want more information about the capabilities of SSH. This User Guide only shows the bare minimum required to connect to your VPS.

A Warning

Warning With great power comes great responsibility. It is trivially easy to render your VPS totally inoperable using just a few Linux commands. Always “measure twice – cut once” when executing Linux commands from the command line of the VPS.

Please understand that eApps is NOT RESPONSIBLE for fixing your VPS if your Linux commands cause the system to become inoperable or to perform poorly.

While we will make an attempt to correct the problem if possible, the only recourse may be to try and restore from the last backup of your VPS. If a restore from backup is required, a $15 charge will be applied.

In some cases, the only thing to do is to restore your VPS back to its default state. This means any applications or files or data or e-mail that resides on the VPS will be over written. This will be done for free, but any assistance needed to help upload or reconfigure your VPS back to its last working state where all your applications and configurations are again in place will be billed at $15 per 10 minute increment.

SSH Clients

By default, SSH runs on port 22 of your VPS. To connect to your VPS using SSH, you will need to use an SSH client. There are dozens of SSH clients, both free and not free, command line and GUI, for all operating systems. Wikipedia has a list of some popular SSH clients, but keep in mind that this is not a definitive list of all SSH clients – http://en.wikipedia.org/wiki/Comparison_of_SSH_clients

Below is a list of some popular SSH clients. eApps neither endorses or recommends any specific SSH client, but it seems that most customers using Windows use PuTTY, and most customers using Mac OS X use the built in Terminal application. Linux customers use whatever terminal emulator is available on their systems, or work directly from the console of their Linux system.

Windows SSH Clients

For Windows, probably the most popular free SSH client is PuTTY, available here - http://www.chiark.greenend.org.uk/~sgtatham/putty/
Information on how to use PuTTY is in the Links to other information section.

Another popular Windows SSH client is SecureCRT, from VanDyke Software. It is not free, but is a very robust and configurable SSH client – http://www.vandyke.com/products/securecrt/index.html

Mac OS X SSH Clients

There are several SSH clients available for Mac OS X, but the most popular one is the Terminal program, which is built into OS X. To access the Terminal program, click on Applications, then go to Utilities. The Terminal program is in Utilities. Make sure to use Terminal, and not Console.

Another free Mac OS X SSH client is JellyfiSSH, which is more of an SSH book mark manager, in that it opens the default OS X terminal program once it connects -  http://www.grepsoft.net/

Linux SSH Clients

Depending on the Linux distro you use on your local computer, and the desktop manager you use, there may be various GUI SSH clients available. Please consult your distro’s documentation and the documentation for the desktop manager you use to see what is available.

All Linux terminal emulators, such as Xterm or Gnome-terminal or Konsole can be used as SSH clients.

Parallels Business Automation – Control Panel

There is also an SSH client built in to the Control Panel, in the Parallels Power Panel (PPP). To access the PPP, go to the Control Panel, and click on the System Tab. If necessary, click the Select Another System (Subscription) link on the left and choose the correct Virtuozzo container. From there, go to Applications in either the main Control Panel window or the left navigation pane, and then click on Parallels Power Panel.

Tech tip The PPP is behind an https connection that uses a self-signed certificate. You will need to add the requested security exceptions and accept the self-signed certificates to be able to access the PPP.


The login for the PPP is root, and the root user’s password. Once logged in, click on SSH Connection in the Container Services section to open the built in SSH client. You must have Java installed on your personal computer to be able to use the SSH client in the PPP.

How to connect with SSH

Programs like PuTTY, SecureCRT and JellyfiSSH use a type of bookmark manager system, where you enter the connection information (user name, hostname, password, etc) into a wizard, and that information is saved. Then, to connect, you open the program and choose the connection you want.

Other programs, like Terminal in Mac OS X and most Linux terminal emulator programs, require you to manually enter the connection information each time. The general format for this is ssh user@hostname, where user is the user you are trying to connect as, and hostname is the domain name or IP address of the server you are connecting to.

[This example from Terminal on Mac OS X]

macbook:~ $ ssh webadmin@example.com
webadmin@example.com's password: passwd
Last login: Tue Nov 10 07:12:03 2009 from 192.168.7.158
[webadmin@example ~]$

SSH Users

Most customers use the root user to connect to their VPS with SSH. However, this is not the best option. The best thing to do is to connect to the VPS as a regular user, and then use the su – command to switch users to the root user once you are connected to the VPS.

Warning The root user is the system superuser, and has the access rights to add, modify and delete any file or directory on the VPS with no restrictions.

This means that as the root user, you can delete files or directories that can render your VPS totally inoperable, to the point that it has to re-provisioned back to its original state. There will be no warning messages or chances to undo.


Before you edit, remove, move or otherwise modify any files on your VPS as the root user, make certain you know what that file or directory does. It is always a good practice to make a backup of any file before you edit it, so that any changes can be reverted back if necessary.

When possible, do not work as the root user for normal tasks, only switch to the root user for tasks that require root user privileges.

macbook:~ $ ssh webadmin@example.com
webadmin@example.com's password: passwd
Last login: Tue Nov 10 11:03:25 2009 from 192.168.7.158
[webadmin@example ~]$ whoami
webadmin
[webadmin@example ~]$ su -
Password: passwd
[root@example ~]# whoami
root
[root@example ~]#


See the su man page for more details. Information about how to use man pages is in the Linux Commands section of this User Guide.

Adding or modifying users

To create a new user that can connect via SSH, or to change an existing user to one that can connect via SSH, follow these steps.

Log in to the Control Panel, and click on the System Tab. If necessary, click the Select Another System (Subscription) link on the left and choose the correct Virtuozzo container.

Go to Users and Groups – Users. To add a new user, click on the New User icon, and fill in the required information. One thing to note – do not make this user a System user unless you know exactly what you are doing, and why. There is generally no reason at all for a regular VPS user to be a System user.

To modify an existing user to allow it to connect via SSH, in the User section, click on the user in question, and then look at their Shell. If it is set to /sbin/nologin, then it must be changed to an actual shell. Most users choose /bin/bash, but you can choose any shell you are familiar with.

This is also where you can set or change the password for a user or add them to any additional secondary groups.


Linux Commands

Once you have connected using SSH, you will need to use standard Linux commands to maneuver around the file system, and manipulate files and directories and applications. There are literally thousands of web pages on how to use Linux, and a search on Amazon shows 25,000+ matches for “Linux”.

There are over 2000 commands available on a VPS.
(This is the result of logging into the VPS via SSH as the root user, and pressing the tab key twice)

[root@example ~]#
Display all 2238 possibilities? (y or n)

In the Links to other information section at the end of this User Guide are a brief selection of links to some Linux command references. Again, there are probably thousands more like the ones listed available online.

Another way to find out what a Linux command does is to use the “man pages”, or manual pages for a command. The man pages are built into the Linux system, and reading the man pages to understand a new command or a little known flag for a common command is considered a basic part of any Linux users skill set.

This example shows the first part of the man page for the ls command, which lists the contents of a directory. (The DOS equivalent would be the dir command)

[root@example ~]# man ls
LS(1)                            User Commands                           LS(1)

NAME
       ls - list directory contents
SYNOPSIS
       ls [OPTION]... [FILE]...
DESCRIPTION
       List information about the FILEs (the current directory by default).  Sort entries alphabetically if none of -cftuvSUX nor --sort.

To see more information on how to use man pages, type man man at the command line. The man pages are an invaluable tool, please learn how to use them and use them frequently.

Note Please understand that eApps Support is not here to teach you how to use Linux. We will assist you when needed, but it is your responsibility to take the time and make the effort to learn to use Linux effectively. The only way to learn Linux is to use it on a regular basis.


Links to other information

FOSSwire Linux Command Cheat Sheet – http://fosswire.com/post/2007/8/unixlinux-command-cheat-sheet/
O’Reilly Linux Command Directory – http://www.oreillynet.com/linux/cmd/
Linux Command Line Reference – http://www.pixelbeat.org/cmdline.html
SSH Cheat Sheet - http://www.cheat-sheets.org/saved-copy/OpenSSH_quickref.pdf
PuTTY Documentation – http://www.chiark.greenend.org.uk/~sgtatham/putty/docs.html
Using the Mac OS X Terminal – http://oreilly.com/pub/ct/51 (Not specifically for SSH, but useful for reference)
eApps has a video tutorial on PuTTY available here – https://support.eapps.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=199&nav=0

Comments

Please login to comment