Offer Alert | 71% + 5% Off & 26-days Extra Lab | Use Coupon Code RDC on Checkout |

  Enroll Now

Linux Basics

79 / 87

Permissions - setting setuid

You can make a program setuid by giving 's' instead of 'x' permission. If you have written a script, an example would be:

chmod +s
  1. Start creating file with the name in /tmp directory:

    nano /tmp/whoownsit_$

    Note: If your user name is sandeep1234, the filename would be

  2. Put the following content in the editor in the previous step:

  3. Save it by pressing Ctrl+x and press "y"

  4. Give it setuid permission:

    chmod +sx /tmp/whoownsit_$
  5. Check if you have given correct permission by

    ls -l /tmp/whoownsit_$

It should display something like this in permissions: rwsrwsr-x

Note: Setuid doesn't work in shell sctipts. Please see