I've writen a perl script that needs sudo rights, but it accepts parameters that are always different. eg
sudo /home/user/script.pl user
I guess adding this to visudo will not work. Is this possible? If not I was thinking about maybe using something like a pipe to solve this problemm like:
echo user | sudo /home/user/script.pl
Is there a way to pass variables this way to a perl script?
The only other option I see is writing the parameters to a file. Then I can still add the script to visudo.
Why not use ARGV? content of tmp/script.pl
and as result
Or you can use Getopt::Long (extended processing of command line options)