UNIX Sysadmin Boot Camp: SSH

Ryan RobsonYou’ve had the weekend to mentally prepare yourself for the first “workout” in our UNIX Sysadmin Boot Camp, so now that you’ve finished stretching your hammies, we’ll jump right into training. In Welcome to the Jungle, I talked about the command line as a fantastically powerful resource, so my goal is to help you wield that power.

Before you can do any actual wielding, you’re going to need to know how to find this exotic “command line” we’ve already talked so much about. Unless you managed to sneak your way through the layers upon layers of security and into your server’s data center, you won’t be able to plug a keyboard and monitor directly into your server. You do have access to the next best thing, though: the Secure Shell – or SSH – network protocol. SSH allows data to be exchanged securely between two networked devices, and when the “network” between your workstation and server is the Internet, the fact that it does so “securely” is significant.

Instructions to SSH into your server are included in your introductory information from The Planet, as well as in your Orbit interface. You can use a third-party client such as PuTTY, WinSCP if your workstation is Windows-based, or if you’re on Linux or Mac, you can access SSH from your terminal application: ssh user@ipaddress. Once you’ve gotten into your server, you’ll probably want to find out where you are, so give the pwd command a try:

user@serv: ~$ pwd/home/useruser@serv: ~$

It’s as easy as that. Now we know we’re in the /home/user directory. Most of the time, you’ll find yourself starting in your home directory. This is where you can put personal files and documents. It’s kind of like “My Documents” in Windows, just on your server.

Now that you know where you are, you’ll probably want to know what’s in there. Take a look at these commands (extracted from a RedHat environment, but also usable in CentOS and many other distributions):

user@serv: /usr/src $ lsThis will give you a basic listing of the current directory.
user@serv: /usr/src $ ls /usr/src/redhatThis will list the contents of another specified directory.
user@serv: /usr/src $ ls ./redhat Using a “relative pathname,” this will perform the same action as above.
user@serv: /usr/src $ ls redhatMost of the time, you’ll get the same results even without the “./” at the beginning.
user@serv: /usr/src $ cd /usr/src/redhat/This is an example of using the cd command to change directories to an absolute pathname.
user@serv: /usr/src $ cd redhatThis is an example of using the cd command to change directories to a relative pathname.
user@serv: /usr/src/redhat $ cd /usr/srcTo move back on directory from the working directory, you can use the destination’s absolute path.
user@serv: /usr/src/redhat $ cd ..Or, since the desired directory is one step down, you can use twp dots to move back.

You’ll notice many similarities to the typical Windows DOS prompts, so it helps if you’re familiar with navigating through that interface: dir, cd, cd .., cd /. Everything else on the other hand, will prove to be a bit different.

Now that you’re able to access this soon-to-be-powerful-for-you tool, you need to start learning the language of the natives: bash. In our next installment, we’ll take a crash course in bash, and you’ll start to get comfortable navigating and manipulating content directly on your server.

-Ryan

StumbleUpon
Twitter
DZone
Digg
del.icio.us
Technorati

Related Posts

Comments are closed.