-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


18 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?

  8. 9 クロムハーツ tシャツ July 16, 2014 at 5:03 am

    Hello, i believe that i noticed you visited my site thus
    i came to go back the choose?.I’m trying to in finding issues
    to improve my site!I suppose its good enough to use a few of your ideas!!

  9. 10 soci vidz bonus products August 18, 2014 at 4:57 pm

    Great blog here! Additionally your website a lot up fast! What host are you the use of?
    Can I am getting your associate hyperlink to your host?
    I desire my web site loaded up as fast as yours lol

  10. 11 hp printer repair August 28, 2014 at 3:09 am

    What’s up to every single one, it’s really a pleasant for me to pay a quick visit this website, it includes
    priceless Information.

  11. 12 Ball field BAR dui defence reaction attorneys September 2, 2014 at 1:59 am

    Good day! This post could not be written any better!
    Reading through this post reminds me of my old room mate!
    He always kept chatting about this. I will forward this post to him.
    Pretty sure he will have a good read. Thank you for sharing!

  12. 13 wikipedia reference September 4, 2014 at 11:13 am

    WOW just what I was searching for. Came here by searching for aktyvus

  13. 14 relationship counseling September 19, 2014 at 12:18 am

    Why users still make use of to read news papers when in this technological globe all is existing on web?

  14. 15 Merry Christmas Qoutes December 13, 2014 at 4:44 pm

    We’re a group of volunteers and starting a brand new scheme in our community.
    Your web site offered us with helpful info to work on. You’ve performed an impressive activity and our
    entire community will likely be thankful to you.

  15. 16 shen March 17, 2017 at 4:39 am

    what does ‘s’ in output of ls -ltr cmd means,
    Example: I run ‘chmod 4755 file’ then did ‘ls -ltr’ the o/p is
    -rwsr-xr-x 1 root root 4773748 Mar 16 23:50 file

    what does ‘s’ means

  1. 1 [ 12 ] - TalkinWeb Trackback on January 31, 2008 at 4:36 pm
  2. 2 machine a sous gratuite dragon island Trackback on November 11, 2014 at 3:34 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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: