Difference between revisions of "Permissions"

From Hackepedia
Jump to navigationJump to search
m (technically)
m (changing permissions)
 
Line 1: Line 1:
 
[[Image:permission.jpg]]
 
[[Image:permission.jpg]]
 +
 +
 +
== Intro ==
  
 
Permissions, also called mode, are the part of an [[inode]] that grant access to a file to different users in a system.  Technically the mode is a 16 bit unsigned integer and has bits set for different inode modes.  Most of the time this mode is manipulated in octal or a visual representation as output by the '''[[ls]]''' program.  The type of file is also included in this here is a few examples:
 
Permissions, also called mode, are the part of an [[inode]] that grant access to a file to different users in a system.  Technically the mode is a 16 bit unsigned integer and has bits set for different inode modes.  Most of the time this mode is manipulated in octal or a visual representation as output by the '''[[ls]]''' program.  The type of file is also included in this here is a few examples:
Line 8: Line 11:
 
A symlink that looks like this "lrwxr-xr-x" in ls looks like this in octal mode:
 
A symlink that looks like this "lrwxr-xr-x" in ls looks like this in octal mode:
 
0120755
 
0120755
 +
 +
== Changing permissions ==
 +
 +
One can use [[chmod]] to change the mode of a file.  You use [[chown]] and [[chgrp]] to change the owner and group of the file.
  
  
=== Example permissions ===
+
== Example permissions ==
  
 
To most this will look very strange as we usually use the last 4 octal digits, here is a rundown on a few of them:
 
To most this will look very strange as we usually use the last 4 octal digits, here is a rundown on a few of them:

Latest revision as of 04:46, 24 May 2008

Permission.jpg


Intro

Permissions, also called mode, are the part of an inode that grant access to a file to different users in a system. Technically the mode is a 16 bit unsigned integer and has bits set for different inode modes. Most of the time this mode is manipulated in octal or a visual representation as output by the ls program. The type of file is also included in this here is a few examples:

A directory that looks like this "drwxr-xr-x" in ls looks like this in the octal mode: 040755

A symlink that looks like this "lrwxr-xr-x" in ls looks like this in octal mode: 0120755

Changing permissions

One can use chmod to change the mode of a file. You use chown and chgrp to change the owner and group of the file.


Example permissions

To most this will look very strange as we usually use the last 4 octal digits, here is a rundown on a few of them:


04555 "-r-sr-xr-x" setuid to owner file with permissions read-execute for owner, read-execute for group, read-execute for others.

02555 "-r-xr-sr-x" setgid to group file with permissions read-execute for owner, read-execute for group, read-execute for others.

0755 "-rwxr-xr-x" file with permissions read-write-execute for owner, read-execute for group, read-execute for others.

For more information about the modes see /usr/include/sys/stat.h for the S_* defines.

Also see the page covering groups.