Tutorials - Servers > CGI/Shell Server Basics

Tutorials and FAQS: Servers: CGI/Shell Server Basics

Please Note: This tutorial relates to the new CGI Platorm which went live at the end of June 2005

Note: Throughout this tutorial, green is used to indicate the server respones and blue is used to indicate the users typing.

This tutorial describes activating the CGI/Shell Service part of certain PlusNet accounts and basic commands for using the CGI/Shell Server. The tutorial contains information on the following:
  • Activating the CGI/Shell Server
  • Connecting to the CGI/Shell Server
    • Using Telnet
    • Using SSH
  • Basic CGI/Shell Server Commands
  • More Information on the Server

Activating the CGI/Shell Server

If your PlusNet account type allows you access to the CGI server, you should see the following link appearing on your Website Settings page.
Once you click the link, you will be taken to the CGI server setup page where you will see a table which is headed "Control your CGI webspace" with the left hand column telling you whether your CGI webspace is active or not and a button to activate/deactivate it.

If it is deactivated, you should click the button and wait for up to 4 days for the details to be emailed to you on postmaster@username.plus.com - although it will tend to be quicker than this.


Understanding your CGI Account's Password

On activating your CGI usage, your CGI password is set to the same value as your normal PlusNet account password, but the CGI password is independent of your normal account password -- changing one does not affect the other.

    Changing your CGI password does not change your normal account password.


Connecting to the CGI Server

Web: When connecting to the CGI server through a web browser, you will be able to use http://ccgi.username.plus.com or if you host a domain, you are able to setup Domain records which enable URIs of the form http://cgi.domain.co.uk to work as well. For more information on this please see the Domain Records tutorial.

FTP: To connect to the CGI server through an FTP client, you should use ccgi.plus.net as the server to connect to and use the username and password detailed in the email. Initially this is the same as your PlusNet account username and password, but you are able to change this at the command line.

To access the shell server through a command line you need either a telnet client or an SSH client. Telnet is an unencrypted protocol, whereas SSH is encrypted. For convenience telnet is more appropriate.

For Windows, most computers come supplied with a telnet client called "telnet" but do not come with an SSH client, so telnet is often more convenient. The "core commands" given for using the shell server will apply to both connection methods, but the connection details are different.
    An attempt to log on to any PlusNet server will succeed only if your Internet connection has been established through PlusNet or one of the other PlusNet ISPs.

Connecting through telnet

To connect using telnet you need to bring up a command prompt window. This can usually be achieved by calling

Start Menu -> Programs -> Accessories -> Command Prompt

When the command prompt window appears, a black window with a prompt such as:

C:\>


You can connect to the CGI server by typing in the command

telnet cshell.plus.net


The window will change and display the following text:

[Connecting]
Linux 2.6.11-plusnet-cgi (<timestamp>)

login:


At the login: prompt type in your username and at password: type in your password. Note, for security reasons nothing is displayed on screen, not even * when you are typing your password.

If you connected through telnet, you may skip the next section.


Connection through SSH

To connect to the CGI/shell server, you need an SSH client. The most common client for Windows is PuTTY, which can be downloaded from http://www.chiark.greenend.org.uk/~sgtatham/putty/

You need to download putty.exe to a directory on your computer. For convenience, make a shortcut to this file on your desktop, or in your start menu.

When you click on the PuTTY shortcut, a window will appear which looks like the following:



For connecting to the CGI server, you should put username@ccgi.plus.net (replacing username with your username) in the Host Name box and choose the SSH radio button. This will automatically change the port to 22.

A black window with:

Sent username "username"
username@cgi.plus.net's password:


appears, and you should type in your password and again press Enter.


After Connection

After connecting to the CGI/Shell Server you should see the following:
Last login: <date> from username.plus.com

and then some information about the platform.

You will then be shown a prompt of the form

username@shell1 username $


The prompt is the bit after the $ where commands you type appear.


Core Commands

Identifying your "home" directory

When you log on, you start off in your "home" directory. After having done some work, you may have moved away from your home directory, but you can rely on the fact that the "cd" command, entered with nothing else, will always take you back to your "home" directory. "pwd" can then be used to display the full path name of that directory. (The "cd" and "pwd" commands are explained in more detail later.) So, to find out the name of your home directory, you can enter the two commands (by separating them with a semi-colon, they may be entered on a single line):

username@shellx anyfolder $ cd;pwd
/files/homex/username
username@shellx username $


Many applications you might install require you to enter the full directory path of a particular file or directory. You can discover this by using a combination of the cd and pwd commands: use the cd command to move to the required directory (or to the directory containing the file you're interested in) and then use the pwd command to print the full path name of that directory.

Finding Where you Are

To find out the full path to your files on the CGI server, you can issue the command: pwd at the command prompt.

This will result in:

username@shellx username $ pwd
/files/homex/usernamep
username@shellx username $


where homex is one of home1, home2 or home3.


Changing your password

If you are asked to change your password, or you decide you wish to use a different password for accessing the Shell Server, you can.

username@shellx username $ passwd
Changing password for username
(current) UNIX password:

At this point, you should type your current password
Enter new UNIX password:
Retype new UNIX password:

At these prompts you should enter your new password.
If all is successful, you should see
passwd: all authentication tokens updated successfully


Exiting

When you are finished on the shell server, you can exit it by using the exit command.

username@shellx username $ exit


"logout" will briefly appear on the screen and the window should close.


Finding What Files are in the Current Directory

To find out what files are stored in the current directory you can issue the ls command:

username@shellx username $ ls
cgi-bin


By default, the only entry listed is the cgi-bin directory.


Creating Folders

To create new folders on the CGI server you use the mkdir command:

username@shellx username $ mkdir test



Changing Directories

To change into the new folder you have created, you use the cd command

username@shellx username $ cd test
username@shellx test $


If you wish to move back up to the previous folder you use .. as the directory to move into.

username@shellx test $ cd ..
username@shellx username $



Removing Files/Folders

To remove a file from the server, you use the rm command:

username@shellx username $ rm test.txt
username@shellx username $


To remove a folder from the server, you need to replace rm with rmdir.


More Information on the Server

If you wish more information on the configuration of PHP and Perl on the CGI server, you can find more information at the following links.

PHP Information: http://ccgi.plus.net/phpinfo.php
Perl Information: http://ccgi.plus.net/cgi-bin/perlinfo.cgi
Original Article by: csogilvie - Edited by: csogilvie