#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    1
    Rep Power
    0

    Suid permission and passwd command


    I'm using Ubuntu 12.04 and learning about linux commands. So I'm going through the Ubuntu Unleashed 2012 edition book and I come across a passage under a section titled: "Understanding Set User ID and Set Group ID Permissions"

    One commonly used program with suid permissions is the passwd command:

    matthew@ubuntu:~$ ls -l /usr/bin/passwd
    -rwsr-xr-x 1 root root 42856 2010-01-26 10:09 /usr/bin/passwd

    This setting allows normal users to execute the command (as root) to make changes to a root-only-accessible file /etc/passwd
    So I a bit confused because the command points to the /usr/bin directory but the passages states that the changes are made to /etc/passwd. Could someone clarify what I'm missing here.
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,064
    Rep Power
    9398
    The program is /usr/bin/passwd. What it does is make changes to a file named /etc/passwd.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,448
    Rep Power
    1751
    What requnix says!
    What the setgid and setuid 'bits' of permissions do is let someone run a program s if they had the permission/access level of the group or owner of the program. And yes, that IS dangerous, which is why it should be used with care.

    In this example (of the passwd program) the setuid 'bit' is set (the s in the rxs of the owner permissions) which means that anyone who can run the program will effectively run it with the access rights of the owner. That is needed here as the /etc/passwd file is protected against update by only allowing the root user to do so.
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    1
    Rep Power
    0
    Appreciate that clarification. Unfortunately, I had to create a new account cause I had trouble resetting my password for OkComputer24. Thanx a lot though.

IMN logo majestic logo threadwatch logo seochat tools logo