Data Science Certification Course (AI/ML + DL + Big Data + Python) by E&ICT, IIT Roorkee for $179 | Expires inEnroll Now
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:
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:
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 sctipts. Please see http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html
Taking you to the next exercise in seconds...