Unix info
The information on this page
was taken from and http://service.depaul.edu/dpo/support/unix/intro.html#Listing Your UNIX account begins with the root directory. This is the area you arrive in after login. In order to move into another directory you need to use the cd command as in cd public_html. To move back to the root directory from any other directory in the account, type cd. The asterisk * is a "wildcard" which means that by using it the account searches for all things that match the prefix and then allows you to access them. For instance cd pub* would change you into the directory that starts pub. As long as there is only one pub directory you won't have problems. Permissions (also known as the chmod discussion) Your UNIX account requires that you set permissions. Permissions refer to the ability to read, write or execute a file. Read Permission: This allows the file to be "read-only" by people with the appropriate permission. This means that a file/page can be read or seen from the Internet. Write Permission: This allows people with the appropriate permission to write to, and change your files. This means that a file can be coded or in some way modified by the user/audience. Execute Permission: This allows others to execute, or run these files, if they have permission to. Setting permission in UNIX is done with the chmod command. As permissions allow for the possibility of writing and executing to your account, be very careful with the permissions you set. Make sure that you are setting permissions in the correct area (i.e. what section of your account are you in? The root? Public_html directory?) In order to determine what permissions are set for a file or directory type ls -l which gives the long list of info about a file including the file attributes, owner, group, file size, date of last modification, and file name. For example: The string on the left side of each file description details what permissions are set for that file. The string can be broken down into the following sections:
The first 'bit' of this entry indicates whether the file is a directory or not. If the first bit is a d, this indicates a directory. The next three segments of three bits each define what permissions are set for what users. User is defined as the person who created the file. Group is defined as the group of people on the local system that may be able to access that file. Other is defined as anyone that may be able to access that file, regardless of which system they are on. Each one of these three-bit segments is formatted in the following way rwx With r denoting read permission, w denoting write permission, and x denoting execute permission. So, if the bits are set up as r-x, which would mean that only read and execute permissions are on. -rw-r--r-- 1 sberger psycfclt 0 Sep 24 10:15 index.html Now we can see, that the file index.html has:
To change permissions you use chmod. The format of the command is: Chmod bitstring filename Where bitstring is a number, corresponding to the permissions you would like to set on a certain file. The bitstrings are formed in the following way. They consist of a three digit number in which the first digit refers to the user permissions, the second digit refers to the group permissions and the last digit refers to the other permissions. The digits are calculated in the following way:
To give multiple permissions, simply add the numbers. For example, to give read and write permissions the digit used would be 6 (4+2) and to give all permissions, you would use a 7 (4+2+1). Now, to finish the task, simply insert the proper digit in the proper place in the bitcode, and you are all set. Examples chmod 711 filename
chmod 644 filename
chmod 755 filename
|