Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Question why "su" and "sudo" commands need to be Set-UID programs

    hi dears,
    i'm new user of ubuntu OS,so i have two question??
    1-why "su" and "sudo" commands need to be Set-UID programs??
    2-What will happen if they are not?

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Hi and welcome

    1) They need it, because they deal with privilege escalation and/or user switching.
    2) Then they dont work
    You must always face the curtain with a bow.

  3. #3
    may u explain more???

  4. $spacer_open
  5. #4
    Linux Guru
    Join Date
    Oct 2007
    Tucson AZ
    Most Linux distributions require the creation of an administrative user (root) and a general user and this is mostly done during installation. Ubuntu doesn't, it uses sudo and the first user created gets administrative privileges. If you have a more specific question, you should explain the context.

  6. #5
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Either at home or at work or down the pub
    First of all we have to ask what do sudo and su do? Simply put, they run a process as a different user. This is usually root but in the case of su, it doesn't have to be. It is probably a lot more complex under the hood than I am implying here! Then we have to ask what is the setuid bit for? Again this probably is a simplification but it gives the executable the permissions of it's owner when it is executed.

    To execute programs or act outside of your home directory on a Linux / BSD / Other *nix system you will need root privileges. You can either log off and log back on as the root user if that is even allowed on the system or you can run su or sudo which will temporarily change your identity to the system. This is an action that also requires authorisation, either via the root password or being allowed via the sudoers file.

    Hopefully this shows why the setuid bit is needed on the su and sudo programs and why it wouldn't work without it.
    Should you be sitting wondering,
    Which Batman is the best,
    There's only one true answer my friend,
    It's Adam Bloody West!

    The Fifth Continent

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts