pavement

Numeric permissions

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
Line 2: Line 2:
 
   
 
   
 
permissions are shown when you do an '''ls -l''' on a file or directory:
 
permissions are shown when you do an '''ls -l''' on a file or directory:
[dave]@deus ~ % ls -l
+
[[Image:Permissions-example.png|thumb|Description]]
total 4
+
drwxr-x---  2 dave  dave  512 Sep 12 03:27 bin
+
drwxr-x---  2 dave  dave  512 Sep 12 03:27 oldstuff
+
-rw-r-----  1 dave  dave    0 Sep 12 03:22 personal.info
+
-rw-r--r--  1 dave  dave    0 Sep 12 03:20 phone.numbers
+
-rw-r--r--  1 dave  dave    0 Sep 12 03:20 privatefile
+
-rw-r-----  1 dave  dave    0 Sep 12 03:24 shopping.list
+
lrwxr-x---  1 dave  dave  13 Sep 12 03:28 useful -> useful.script
+
-rwxr-x---  1 dave  dave    0 Sep 12 03:25 useful.script
+
[dave]@deus ~ %
+
  
 +
The green circle highlights the first bit, which tells you if the file is a regular file (with a '''-'''), a directory (with '''d''') or a link (with '''l'''). The next three bits show you the permissions on the file for the file's ''owner'' or ''user''. The next three show you permissions for the group the file belongs to. The last three show you permission for ''others'' -- anyone who is not the file owner or member of the group is ''other''.
  
Those -rw-r----- bits are the permissions of the file and they break down as follows:
+
Permissions bits read '''r''' (the file can be read), '''w''' (the file can be written to), or '''x''' (the file is executable); a '''-''' in the place of any of those means that that bit is set to off.
- the first bit tells you whether this is a directory, a link or a regular file
+
  the - indicates it's a regular file, a '''d''' for directory or an '''l''' for link
+
+
  
this needs:
+
==Context is everything===
 +
Note that the directories are set as executable for both user and group members. You have to "execute" a directory when you [[cd]] into it as well as (somewhat more importantly) when you ''search'' it.
  
-a comparison between unix permissions and windows permissions
+
==How default permissions are set==
 +
Which permissions you file are created under by default are set by your [[umask]], which is often set in your [[shell]] configuration file ([[.bashrc]], [[.bash_profile]], [[.cshrc]], [[.tcshrc]], etc. -- can also set your [[umask]] by just running [[umask]]).
  
-an explanation of owner, group and other permissions
+
==Changing file permissions==
 +
You can change the permissions of a file with [[chmod]] and the owner/group of a file with [[chown]] (group can also be set with [[chgroup]]
  
-exp of diffs between dir permissions and file permissions
 
  
- links to [[chmod]] and [[chown]]
 
  
-d
+
this needs:
 +
 
 +
-a comparison between unix permissions and windows permissions

Revision as of 04:05, 12 September 2004

Contents

How permissions are defined

permissions are shown when you do an ls -l on a file or directory:

Description

The green circle highlights the first bit, which tells you if the file is a regular file (with a -), a directory (with d) or a link (with l). The next three bits show you the permissions on the file for the file's owner or user. The next three show you permissions for the group the file belongs to. The last three show you permission for others -- anyone who is not the file owner or member of the group is other.

Permissions bits read r (the file can be read), w (the file can be written to), or x (the file is executable); a - in the place of any of those means that that bit is set to off.

Context is everything=

Note that the directories are set as executable for both user and group members. You have to "execute" a directory when you cd into it as well as (somewhat more importantly) when you search it.

How default permissions are set

Which permissions you file are created under by default are set by your umask, which is often set in your shell configuration file (.bashrc, .bash_profile, .cshrc, .tcshrc, etc. -- can also set your umask by just running umask).

Changing file permissions

You can change the permissions of a file with chmod and the owner/group of a file with chown (group can also be set with chgroup


this needs:

-a comparison between unix permissions and windows permissions

Personal tools