WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
SELECT rating_username, rating_rating, rating_ip FROM wp_ratings WHERE rating_postid =

Using SSH to Manage Your Account

Vote This Post DownVote This Post Up (No Ratings Yet)
Loading ... Loading ...

One of the frequently overlooked tools web masters can use when managing their hosting accounts is that of secure shell, or SSH. SSH is a means of controlling your account through command-line, much like the MS-DOS or Command Prompt people may be familiar with in Windows.

So what are the advantages of SSH? SSH allows you to control your account on-the-fly, much like you would with cPanel’s File Manager or an FTP client. However, instead of having to download your files, modify them, and then re-upload to the server as you would with FTP, SSH lets you make the modifications right on server just as if it were your own computer. In addition to making changes to the content of files, there are several commands you can use that let you run programs directly on the server or make mass file attribute modifications.

Working tech support, we will frequently be asked to delete files from user accounts, change file permission levels, or check when a set of files were last updated. SSH allows you to do this much quicker than through cPanel or FTP. Some of the commands are below. If any commands are between quotations, simply enter the command(s) without the quotes.

cd – cd allows you to change your directory relative to your current location. If you are in your public_html folder and want to go to your image folder, you’d type in the command “cd image”. If you are in your root/home folder and want to go to the same image folder, you’d have to type in the full path relative to your location. On ReadySetConnect hosting accounts, the cd command would be “cd public_html/image”. To go up a directory, say from image to public_html, execute “cd ..”.

ls – So now that you can change directories, how do you know what’s available to you? Typing in “ls” will list for you all of the folders and files available from your current location. In the above image folder example, if you were to type in “ls” while in your public_html folder, one of the results would be “image”. You can also pass options to ls if you want more information to be presented. For example, to view the times your folders and files were last modifed, type in the command “ls -l”. If you want to see the list sorted so your most recent modifications appear at the end, type in “ls -ltr” to list the files with extra information, sort by time, and then reverse the order of the output.

pico – Pico is just one of several editors you can use to make changes to your files. Others include vi or nano, which is oftentimes the same as pico. To open a file with pico, simply enter “pico filename”. The filename can either be a new file, a file in your current directory, or a file in another directory. If you’re opening a file in another directory, the path is the same as it would be with the cd command. Let’s say you want to make a new PHP file in your image folder, but you’re currently in your home folder. The command to open the file in pico would be “pico public_html/image/file.php” where file.php is the name of the PHP file. Once in the editor, it works much like any word processor with the exception of navigation using a mouse. The commands available are listed at the bottom of the screen, sometimes marked with a caret “^” before the letter. The caret simply means to hold down the control/ctrl key on your keyboard as you hit the letter. For example, let’s say you’ve edited your file and want to save it. This is accomplished by holding down the ctrl key while hitting the x. The editor will ask you if you want to save your file, Y or N for yes or no, and then it will exit the program.

chmod – Chmod allows you to modify the permission levels of your files. We won’t get too specific with permissions here, however if you’re ever told to modify a file to say 755, the command to execute is “chmod 755 filename”. If you want to modify all PHP files to 755, you can use a wildcard in your filename, which simply means using an asterisk “*” where the characters can be anything. For example, if we wanted to change all PHP files, the command would be “chmod 755 *.php”. This command would set any file in your current directory, ending with “.php” to 755. If you want the system to change the permissions in the current directory and for any files in lower directories, add the “-R” flag. An example is provided in the wrap-up below.

Now that we’ve covered some of the basic commands, let’s put them to use. Let’s say we just signed into SSH and want to make a PHP file in our image folder. First, let’s check if we’re in that folder. To do this, we type in “ls” and hit enter. Ls returns the list of folders in our current directory, and the only folder is the image folder we’re looking for. To move to this image folder, type in the command “cd image”. Once there, let’s open the PHP file. To do this, we use pico with the command “pico test.php”. Once pico opens, we type in our content, say the text “Hello, World!”. After we’re done, we hit ctrl+x on the keyboard, hit Y to confirm that we want to save the file, and then hit the enter or return key to be taken back to the prompt. From here, let’s go back to our original folder, so we enter the command “cd ..”. Finally, let’s change the permissions for all PHP files in the current directory as well as all of the files in the image folder, including the one we just made. To do this, we type in “chmod -R 755 *.php”. This will recursively go through all folders and set the permissions of any file that ends in “.php”.

If your web hosting account is provided by ReadySetConnect and you do not have shell enabled, you may have to contact us at our support desk by going to http://support.readysetconnnect.com. Once you have shell enabled you will have to download a client. We recommend PuTTY. When you want to access your account, simply execute PuTTY and enter your domain name as the hostname. When it asks for login credentials, enter your cPanel username and then your password at the password prompt.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG

2 Responses to “Using SSH to Manage Your Account”

  1. Its good to know that SSH allows one to control his/her account on-the-fly, much like one would with cPanel’s File Manager or an FTP client.Knowing the advantages of SSH I do agree that its use is beneficial.Now I am able to manage my account.

  2. Its new for me that SSH is a means of controlling your account through command-line, much like the MS-DOS .What I like about it is that it can provide me some benefits so I’ll prefer it for managing my account.

Leave a Reply

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <code> <em> <strong>