Jump to main contentmickwood.com - Website Hosting & Design for Christian Organisations
Support

"If we don't know it's broken we can't fix it!"

Support FAQ Homepage

Can't find the answer?

SSH & Shell Access

  1. How do I TAR and compress files in one step?
  2. How do I create a TAR archive of a directory?
  3. How do I decompress and extract a TAR archive in one step?
  4. How do I create a symbolic link?
  5. How do I find files and directories?
  6. How do I find information on other UNIX commands?
  7. How do I launch SSH or Shell Access tools?
  8. How do I setup a cron job?
  9. What are some commonly used UNIX shell commands?

1. How do I TAR and compress files in one step?

To archive and compress a directory called 'target' in the current working directory into a file called target.tgz use:

tar cf - target | gzip -c > target.tgz

The - in the place of a tar output filename directs tar to send its output to the standard output which is redirected to gzip.

Back to top


2. How do I create a TAR archive of a directory?

A common task in UNIX operating systems is creating an archive of many files or directories in a single file. The tar command is one option for archiving and has many options and can do many things.

In a simple example, you can create a file called archive.tar of all the files and subdirectories in the current directory with the following command:

tar cf archive.tar *

Note that this file is different from a zip archive commonly used in Windows environments because it is uncompressed.

Back to top


3. How do I decompress and extract a TAR archive in one step?

To extract the compressed TAR archive target.tar.gz into the current working directory with:

gzip -dc target.tar.gz | tar xf -

If the archive was compressed with the UNIX compress command (archive ending in .Z) you can use: 

zcat target.tar.Z | tar xf -

4. How do I create a symbolic link?

A symbolic link is a pointer to another file or directory. It can be used just like the original file or directory. A symbolic link appears in a long listing (ls -l) with a reference to the original file/directory. A symbolic link, as opposed to a hard link, is required when linking from one filesystem to another and can be used within a filesystem as well.

To create a symbolic link, the syntax of the command is similar to a copy or move command: existing file first, destination file second. For example, to link the directory /home/username/public_html/matt/private/forum to /phpbb for easy access, use:

ln -s /home/username/public_html/matt/private/forum /phpbb

Back to top


5. How do I find files and directories?

To search the current directory and all subdirectories for a folder or file, use the following command:

find . -name filename

- where filename is the file or folder for which you are looking...

To search one directory and all its subdirectories use the following command:

find foldername -name filename

- where filename is the file or folder for which you are looking and foldername is the folder in which you want to search.

Back to top


6. How do I find information on other UNIX commands?

The UNIX command line interface is wonderful. With that power comes complexity if only in the sheer number of commands. Even seasoned UNIX gurus need help remembering the syntax of less frequently used commands. Fortunately, UNIX has a great built-in manual called man.

To get information for a command such as cd, use:

man cd

If you are not sure what the name of a command is, try using a keyword search. The keywords are matched against the Name line in each known man page which contains the name of the command and a brief description of its function. To search for man pages relating to SQL databases, commands, or functions, use:

man -k sql

Back to top


7. How do I launch SSH or Shell Access tools?

Overview

SSH (Secure Shell) is a program to log into another computer/server over a network securely. It provides strong authentication and secure communications over insecure channels. Your login, commands, text are all encrypted when using ssh. You can login to your site via SSH through the control panel using a Java SSH client or directly from your computer using a third party SSH program.

SSH allows secure file transfer and remote logins over the internet. Your connection via SSH is encrypted for a secure connection. You can manage your SSH keys to allow automation when logging in via SSH. Using public key authentication is an alternative to password authentication. Since the private key must be held to authenticate, it is virtually impossible to brute force. You can Import existing keys, generate new keys, as well as manage/delete keys.

Java SSH Login

When using the Java SSH clients, you have your choice of two types of clients:

  • Connect using SSHTerm - SSH Term allows you to connect through public key or password authentication without downloading any software. Public key authentication require you to have a copy of your private key locally. This can be obtained by following the instructions in the "Manage SSH Keys" above.
  • Connect using Java Telnet Applet - Java Telnet Applet allows you to connect using password authentication without downloading any software.

To use either client, click on the appropriate link.

Third Party SSH Client Software

In addition to the Java SSH clients, you can login using a third party SSH program, two popular programs are listed below:

To connect use the following configuration settings:

  • Host or IP: yourdomain.com (your domain name)
  • Protocol: SSH
  • Port: 9394
  • Username and Password: Your control panel login information

Manage SSH Keys(Advanced)

Steps

  1. Click on the Generate a new Key link.
  2. Set the following:Click on the Generate Key button.
    • Key Name - Enter the key name you want to use. It can be anything specific to your personal preferences. (If you leave this option empty, it will default to key name "id_dsa").
    • Key Password - Enter a password you want to use for this key. You can leave this option blank if you do not want to use a password.
    • Key Type - Select either DSA or RSA from the drop down menu. RSA and DSA are encryption algorithms used to encrypt your key. DSA is faster for Key Generation and Signing and RSA is faster for Verification.
    • Key Size - Select the key size you want to use for this key. Your choices include (1024, 2048, 4096).
  3. If the key has been generated successfully, you will see a pop-up appear stating "Key Generation Complete!" Click on the OK button.
  4. Click on the Go Back link.
  5. When the page loads, you will see a "Public Keys" table with your newly public key containing the following information, split into three columns:
    • Name - This entry will be the Key name you chose in Step 2 above.
    • Authorization Status - If your key has not been authorized, it will state "not authorized" in this column. To authorize your key, follow the instructions in the "Manage Authorization" section below.
    • Actions - You have three choices:
      • Delete - Click on this link to delete the key.
      • View/Download - Click on this link to view or download the key.
      • Manage Authorization - Click on this link to authorize your key. Once the page loads, click on the "Authorize" button. You should receive a confirmation stating "KEY_NAME has been Authorized." Click on the "Go Back" link. Now when you view the Public Keys table, you should see "authorized' in the "Authorization Status" column for your new key.
  6. In addition to the "Public Keys" table, you will also see a "Private Keys" table with your newly public key containing the following information, split into two columns:Now that you have created a new key, review the following information:
    • Name - This entry will be the Key name you chose in Step 2 above.
    • Actions - You have three choices:
      • Delete - Click on this link to delete the key.
      • View/Download - Click on this link to view or download the key.

The public and private key are similar to a puzzle. They are created together to use during the login/authentication process. The public key resides on the server (the remote location) The private key resides locally on your computer/server. When you attempt to login to a server, the public and private key are compared. If they "match", then you will be allowed to login to the server location.

You can download the private/public keys here and import into PuTTY (or other SSH clients) if you prefer using something else for SSH connections. Or, if you have been using PuTTY, you can import the public/private keys by click on Import Key. You can also download your key in PuTTY's ppk format under View/Download.

  1. Click on the Go Back link.

The video below is a useful guide to SSH Access.

Back to top


8. How do I setup a cron job?

Via the "crontab" command from the shell.

crontab -l will show you your currently set up cron jobs on the server.

crontab -r will delete your current cron jobs.

crontab -e will allow you to add or edit your current cron jobs by using your default text editor to edit your "crontab file".

Your crontab includes all the cron jobs you'd like, with one cron entry per line. A cron entry looks like this:

45 2 * * * /home/user/script.pl

  • The first number is the minute of the hour for the command to run on.
  • The second number is the hour of the day for the command to run on.
  • The third number is the day of the month for the command to run on.
  • The fourth number is the month of the year for the command to run on.
  • The fifth number is the day of the week for the command to run on.

Here are some examples to help you learn the syntax for the numbers:

  • 24 * * * * : will be run every hour on the 24th minute.
  • 8,45 * * * * : will be run twice an hour on the 8th and 45th minutes.
  • */15 */2 * * *: will be run at 0:00, 0:15, 0:30, 0:45, 2:00, 2:15, 2:30, ...
  • 31 18 * * 7: will be run at 6:31pm every Sunday.

Back to top


9. What are some commonly used UNIX shell commands?

Creating a Directory

You can create a directory by using the mkdir command. For example, to create a directory named images within the current directory:

mkdir images

Changing your Current Working Directory

At any given time, you are located in some current working directory within the Unix file tree. When you log in, your current directory is set to your home directory.

You can change your current working directory any time by using the cd command (this stands for "change directory"). For example, if the current directory has a subdirectory named details, you can change to that directory using the command:

cd details

You can always find out the absolute pathname of the current working directory by typing the command:

pwd

You can return to your home directory by typing:

cd ~

Finding out what Files you Have

You can see what files you have by using the ls command:

ls

This command will give you a list of all the names of your files.

Making a Copy of a File

If you want to make an exact copy of the contents of a file, figure out what you want to name the copy, and then type the command

cp oldname newname

where oldname is the name of the existing file you want to copy. A new file will be created with the name newname and the same contents as the original.

Changing the Name of a File

The Unix mv command can be used to change the name of a file:

mv oldname newname

This will not affect the contents of the file. It will simply change its name from oldname to newname.

Getting Rid of Unwanted Files

Once you have no more need for a file, you can get rid of it permanently by using the Unix rm command.

Warning! When you remove a file, it is gone forever. There is no easy way to get it back. Please be careful that you do not remove a file that you really need.

To delete a file from your account, enter this command:

rm filename

where name identifies the file you want to remove.

you can remove more than one file at a time. For example, this command

rm image1.gif page.html test.txt

would remove the three named files.

Back to top


welcome | name | hosting | design | content | promote | update | showcase | support | general information

Showcase Update Promote Content design Hosting Name Welcome