SSH for the Rest of Us>>

SSH isn’t as scary as most people believe it to be. It’s actually very easy to use and comes in handy more times then one. We’ll go over the basics of SSH, how to use it, which programs to use for SSH, and common tasks webmasters can use with SSH.

We first need to understand what SSH is before we can continue. Understanding what is being used is probable the most important part of learning something new. SSH is basically a command line access to a users account. Everything will be done through command line, similar to DOS.

Depending on how the users account is setup, depends on how access is granted. Some accounts will not have access to some commands. If an error is returned after submitted a command, that command isn’t available. But don’t worry; there are always a few different ways to do each task. So if one command doesn’t work, then try another that does the same thing.

SSH Programs

There are a few different programs that will help a user make an SSH connection. There is actually one built right into Windows. We’ll show examples for each, so if a user prefers one over the other, then they can still use which ever they choose.

Windows SSH

Windows has a built in SSH program that works just as well as all the others. The others have more options and so on for the user to choose from, but if bells and whistles aren’t your thing, then the Windows version is just for you.

First we need to start the program and get it loaded up so we can connect to a server.

Click on the start menu and select run from the menu that opens up, once the run menu has opened type in the box “cmd” without quotes. Once a DOS window has opened type “telnet” without quotes, this will load the SSH program in the DOS window.

Now that the SSH program or in this case, telnet program, has loaded we can make a simple connection to a server. To open a connection to any server simply type “o server.com”, this will try to establish a connection to the server specified; if a connection is established the program will ask for a username and password.

Simply type in the username and password for that account and it should connect with no problem. If it is rejected this either means two things, one the username and password provided is incorrect, or that the server doesn’t support SSH connections. If the server doesn’t allow SSH connections, a user can try to connect through cPanel.

More information about using cPanel’s built in SSH program can be found here: SSH/Shell Access

PuTTY

PuTTY is a 3rd party program designed specifically for connecting to a server using command line. It supports four different types of connections; Raw, Telnet, Rlogin, and SSH, in this case we’ll just use SSH. PuTTY has a lot of different options that a user can choose from and set. This is the best part of this program, as a user can customize any aspect of the command window they’d like.

To make a connection with PuTTY we simply need to input a little data and we can connect within a matter of minutes. Once the program is loaded, at the top, it will ask for a “Host Name (or IP Address)”. Simply input the IP address of the server or the domain name that corresponds to the IP address. After the domain name or IP address has been entered a user can then click on Open to make a connection.

Saving settings to use for later date is very easily done. Under the Sessions tab, or right on the front when the program loads, there is a section called “Saved Sessions” this is where a session can be saved and loaded at a later date. Simply enter a name for the settings entered, and click on save. This will place the name entered in the bottom of the window and a user can load it at any time after it’s been saved.

Once a connection has been made to the server it will appear the same way as the Windows version of the program looks. A username and password will still need to be entered and once this is done a user will have access to the server.

PuTTY can be found here: http://www.chiark.greenend.org.uk/~sgtatham/putty/

First Command

There is one command that will help all users no matter how new or advanced they are, and that’s the “help” command. Simply by typing “help” once connected will return a list of commands that can be used. More information on each command can be found by using the “--help” command.

Let’s us say we want to find out what other options we have for the “ls” or directory listing command. We would simply type “ls --help” and the server would return more information about the command “ls” and other options that can be used with this command.

Getting Around

Now that we’ve made a connection to a server with SSH through the program we prefer, we need to learn to move around and actually see what’s on the server. This first command to be learned will be “ls”. If a user is familiar with DOS, then this command is the same as “dir” and will return the same results. It will return a directory listing of files and folders within the current folder.

Moving Around

Now that we’ve learned how to view what’s in the current directory, we need to learn how to move. This is a very simple command and is the same thing as the DOS counter part. “cd” can be used to move from directory to directory and back again.

Let’s say we’d like to move to a directory inside the directory we’re in, lets say “public_html”. We’d use this command to move into this directory.

cd public_html

We could also move even further inside this directory if there is a directory inside this directory we’d like to move to. Let’s say in this case we’d like to move to the test folder located within the public_html folder.
We’d simply use the same command, but add the other directory to the end of the command. Like this...

cd public_html/test/

This will move us directly to the test folder located within the public_html folder.

Editing Files

Now that we’ve learned a few basic steps on moving around inside the server once we’ve connected to it, we now need to learn how to edit and use all those files we see. The next command is the “edit” command. It’s very simple to use and is normally what is used to edit files. There are other programs that can be used to edit files through command line, but we’ll stick to the basics in this tutorial.

Let’s say we have an index.htm file we’d like to edit within the test folder. We’d simply use this command to open the file so it could be edited.

edit index.htm

This will then load the systems default editor and the file that needs to be edited on the user’s window. Once it’s loaded, we can make any modifications to the file and then save and close it. In most cases all the commands for the editor will be located at the bottom of the window and can be used at any time, these are very easy to understand and read.

Move those Files

Now that’s we’ve went over some of the basic commands and what there used for, we need to learn how to move files from place to place. Copying files is very simple and there are many different methods to the madness. The command we’re going to use to move and copy files are “cp”. The “cp” can be used in a number of ways but we’ll look at the most useful ways to use this command.

Let’s say that we’d like to make a backup of a file, for storage purposes, or if we’re editing the original and just want a backup just in case. We’ll use the “cp” command in this method to make a backup copy of another file.

cp index.htm index.htm.old

This will make a complete replica of the index.htm in the same directory, but with the extensions .htm.old. So we now have a backup copy of this file just in case we mess the original file up.

Let’s us say that we want the same file to be copied, but to another directory. We can achieve this by using the same command but in a different way.

cp index.htm /public_html/new_folder_name/

This will copy the file and move it to the new folder specified above. It will leave the current file intact. This is useful for moving files from place to place, sort of how it’s done in Windows.

After learning this command, we’ve learned the basics of SSH and how to get around in it. These few commands will come in handy more then once with each session. So remember to use them often. Each command that is used on a server has many functions within itself. So remember to check the “--help” command often for new and exciting ways to use each command.


<< Back


Google






   



MSN Nick Name



More Resources...





Most Viewed Services:
  1. HTML Tutorial
  2. XHTML Tutorial
  3. CSS Tutorial
  4. Javascript Tutorial
  5. DHTML Tutorial
  6. VB Script
  7. TCP/IP Tutorial
  8. ADO Tutorial
  9. MYSQL Tutorial
  10. ASP Tutorial
  11. AJAX Tutorial
  12. CFML Tutorial
  13. PHP Tutorial
  14. WML Tutorial
  15. FLASH Tutorial
  16. XML Tutorial
  17. RSS Tutorial
  18. SQL Tutorial
  19. HTML Articles
  1. Javascript Articles
  2. PHP Articles
  3. SEO Articles
  4. Web Design Articles
  5. SEO Tips
  6. Web Design Tips
  7. Articles
  8. CSS
  9. CSS Tips
  10. HTML Tips
  11. JAVASCRIPT Tips
  12. MYSQL Tips
  13. PHP Tips
  14. Money
  15. Tutorials
  16. Web Hosting



  • Home
  • Web Directory
  • Top Directoriers
  • Webmaster Directories
  • Contact
  • © Copyright 2006 All Rights Reserved By CodeDcode.Com