At 09:04 AM 12/12/01 +0100, Richard Swartz wrote the following:

>quite a while back, on another list(HELPNET, ACCMAIL?) you posted a nice
>explanation about how the Unix file permissions result in the three digit 
>octal
>notation we see in attached files (beg*n 666 example.zip). I thought I had
>saved your post, but as chance had it, I was asked yesterday how it works, and
>I couldn't find it. I guess it was lost in the last great data migration. Do
>you happen to still have the original post or could you explain it again? :)

This is the result of a "dir" command at an ftp site.
---------------------------------------------------------------------------- 
----
total 12
-rw-r--r--  1 root  wheel   480 May  1 16:59 RATECARD.TXT
-rw-rw-r--  1 root  wheel   696 Nov 19  1997 README
-rw-r--r--  1 root  wheel  3344 Sep  1  2000 UPLOADS.TXT
drwxrwxr-x  2 root  wheel   512 Oct  5  1998 archive-info
lrwxr-xr-x  1 root  wheel    21 Nov 22  1998 catalog.txt -> 
pub/cdrom/catalog.txt
lrwxr-xr-x  1 root  wheel    26 Nov 22  1998 config.txt -> 
archive-info/wcarchive.txt
drwxr-xr-x  2 root  wheel   512 May  2  1999 etc
drwxrwxr-x  2 root  wheel  2048 Jun 12 20:53 pub
---------------------------------------------------------------------------- 
----

How do you read these Unix style directory listings?
The first byte of the first column tells you what type of file it is:

d : directory
- : file
l : a link to another file or directory

Following that are 9 letters indicating the permissions. The first three 
are permissions for "the owner", the second three for "the group" and the 
last three for "the world".

The access permissions are r=read, w=write, and x=execute. A dash ("-") 
means the permission is not granted.

Read permission -- allows you to look at the file. In the case of a 
directory, it let's you list the directory's contents.

Write permission -- allows you to modify (or delete) the file. In the case 
of a directory, you must have write permission in order to create, move, or 
delete files in that directory.

Execute permission -- allows you to execute the file by typing it's name. 
With directories, execute permission allows you to "cd" into them.

The following combinations are possible: (Binary) (Octal)
"---" (no permissions)                    000      0
"--x" (execute)                           001      1
"-w-" (write-only, very rare)             010      2
"-wx" (write and execute, very rare)      011      3
"r--" (read-only)                         100      4
"r-x" (read and execute)                  101      5
"rw-" (read and write)                    110      6
"rwx" (read, write and execute)           111      7

The second column is the number of links to the file.
The next 2 columns are the owner and user group to which the file belongs 
(these can be numeric).

The next 2 columns are the file size and last modification date and 
optional time.

The last column is the name of the file or directory or a link. The "->" 
characters indicate a link. (This is like an alias, and is often used to 
provide a shortcut to a file buried several subdirectories deep - it saves 
keying). The links also are identified in byte 1 of the first column - 
(l=link). A link can refer to either a directory or a file.
NOTE: some ftp servers may truncate the linked-to file name.

So, looking at a line like this:

-rw-r--r-- 1 ftpuser ftpusers 1498680 Jun 2 03:19 Index-byname

This is a file, ("-") in first byte of column 1
The owner has read and write permission (rw- , he'd better!) (octal 6)
The group has read permission only (r--) (octal 4)
The world has read permission only (r--) (octal 4)
There is 1 link to the file
The owner is ftpuser
The user group is ftpusers
The file size is 1498680 bytes
The date of last modification is Jun 02, 1999 at 03:19 local time
   If there is no year shown, then it's the current year -- usually
The file name is Index-byname (which implies a text file and typically
   is a complete listing of all files in all directories). The most
   common of these names is 00index.txt
So the file permissions for this file would have an Octal value of 644.

--
Gerry Boyd
============= PCWorks Mailing List =================
Don't see your post? Check our posting guidelines &
make sure you've followed proper posting procedures,
http://pcworkers.com/rules.htm
Contact list owner <[EMAIL PROTECTED]>
Unsubscribing and other changes: http://pcworkers.com
=====================================================

Reply via email to