Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
You can make a program setuid
by giving s
instead of x
permission. If you have written a script x.sh
, an example would be:
chmod +s x.sh
Start creating file with the name whoownsit_username.sh
in /tmp
directory:
nano /tmp/whoownsit_$USER.sh
Note: If your user name is sandeep1234
, the filename would be whoownsit_sandeep1234.sh
Put the following content in the editor in the previous step:
whoami
Save it by pressing Ctrl+x
and press y
Give it setuid
permission:
chmod +sx /tmp/whoownsit_$USER.sh
Check if you have given correct permission by
ls -l /tmp/whoownsit_$USER.sh
It should display something like this in permissions: rwsrwsr-x
Note: setuid
doesn't work in shell scripts. Please see http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...