1. install the package perl-suid
2. make root the owner and www-data the group of the file:
Code:
sudo chown:www-data root your_perl_script
3. set the SUID bit, read and exec permissions for the group, no permisions for others:
Code:
sudo chmod u+s,g=rx,o-rwx your_perl_scrip
4. In the first line of the script replace perl with suidperl
e.g. change
to
Code:
#!/usr/bin/suidperl -w
Now if you run the script it's running as root.
Be careful as everyone in the www-data group can run this script as root!
Bookmarks