-rwsr-xr-x Unix file permission

Everybody handling a Unix operating system would very well know what chmod 777 means. That the owner, group and the user of the file is given all permissions (Read, Write and Execute on a particular file). This could otherwise be written as “chmod ugo+rwx “. Meaning that you are giving User, Group and Owner of the file, the rights to Read, Write and Execute the file.

Here comes the rws scenario. Best example that is available for this rws is /usr/bin/passwd command (just issue a “ls -l /usr/bin/passwd”) .

Normally, any user is allowed change HIS password. Meaning he can make an entry or change HIS entry in the /etc/passwd file. But he can never be given ‘WRITE’ permissions on the file because he might end up disturbing other person’s password too. Only a ROOT user is allowed permissions on the /etc/passwd file.

This is where the “rws” comes to picture. When we give “rws” permission to the /usr/bin/passwd command, Unix would assume that the command is executed by the ROOT user. (the user doesnt have permissions on the /etc/passwd file but the root user has). Root user (RWS) permissions could be given on a file as chmod 4700 .

arun@arun-desktop:~/Desktop$ chmod 4700 hi.txt
arun@arun-desktop:~/Desktop$ ls -l hi.txt
-rws—— 1 arun arun 0 2007-01-17 06:48 hi.txt

If you need to act as a group user of a file and not a normal user when executing a particular command (as against the root user) then user “chmod 2700 ”

arun@arun-desktop:~/Desktop$ chmod 2700 hi.txt
arun@arun-desktop:~/Desktop$ ls -l hi.txt
-rwx–S— 1 arun arun 0 2007-01-17 06:48 hi.txt

The 4 and 2 in the front of the chmod commands are called as SUID and SGID bits.

What if we put a 1 instead of 4 and 2 (chmod 1700 ).

arun@arun-desktop:~/Desktop$ chmod 1700 hi.txt
arun@arun-desktop:~/Desktop$ ls -l hi.txt
-rwx—–T 1 arun arun 0 2007-01-17 06:48 hi.txt

It shows a “T” in the place of “x” for a normal user. This “T” bit is called as the Sticky bit.

“When the sticky bit is turned on for a directory users can have read and/or write permissions for that directory, but they can only remove or rename files that they own. The sticky bit on a file tells the operating system that the file will be executed frequently. Files like this are kept in swap space even when they aren’t being executed. Although this takes up swap space it greatly reduces the time it takes to execute the program. Some programs such as vi have the sticky bit turned on by default on some Unixes.”

source : http://www.uwsg.iu.edu

About these ads

9 Responses to “-rwsr-xr-x Unix file permission”


  1. 1 Samuel March 24, 2009 at 7:56 pm

    Thanks for help, I din’t know this useful flags for chmod command

  2. 2 гей знакомства сейчас December 17, 2009 at 6:08 pm

    я считаю: неподражаемо…

  3. 3 Pradeep January 27, 2010 at 4:30 pm

    Really useful….Thanks

  4. 4 Jelle November 11, 2011 at 9:07 am

    Thanks for sharing, do note however that the O stands for Others, not owner:
    “A combination of the letters ugoa controls which users’ access to the
    file will be changed: the user who owns it (u), other users in the
    file’s group (g), other users not in the file’s group (o), or all users
    (a). If none of these are given, the effect is as if a were given, but
    bits that are set in the umask are not affected.

  5. 6 jocuri mario 2 April 5, 2013 at 6:32 am

    each time i used to read smaller articles or reviews that also clear their motive, and that is also happening with this
    piece of writing which I am reading at this place.

  6. 7 mobile phones with large buttons for seniors June 20, 2013 at 7:23 pm

    Greetings! I know this is kinda off topic however , I’d figured I’d ask.

    Would you be interested in exchanging links or maybe guest authoring a blog article or vice-versa?

    My blog covers a lot of the same topics as yours and I think we could greatly benefit from each other.
    If you happen to be interested feel free to send me an e-mail.
    I look forward to hearing from you! Wonderful blog by the way!

  7. 8 Bridgett February 9, 2014 at 11:25 am

    wonderful points altogether, you simply won a logo neww reader.

    What may you recommend about your publish that you made a few days ago?
    Any positive?


  1. 1 [ 12 ] - TalkinWeb Trackback on January 31, 2008 at 4:36 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





Follow

Get every new post delivered to your Inbox.

%d bloggers like this: