Find the answer to your Linux question:
Results 1 to 5 of 5
Like Tree3Likes
  • 1 Post By Irithori
  • 1 Post By yancek
  • 1 Post By elija
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? thanks...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2013
    Posts
    7

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

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,444
    Hi and welcome

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

  3. #3
    Just Joined!
    Join Date
    Nov 2013
    Posts
    7
    may u explain more???

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    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.
    goldengriff likes this.

  6. #5
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,653
    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.
    goldengriff likes this.
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    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
  •