I'm trying to allow my user (via
sudo, launched in a script) to copy a file from their home to a web directory.
Command would be:
sudo cp /home/$LOGNAME/file_source /var/www/$LOGNAME_file_dest
So i added the following line in my sudoers file:
%users ALL=(ALL)NOPASSWD:/bin/cp /home/$LOGNAME/file_source /var/www/$LOGNAME_file_dest
This doesn't quite works, because
sudo asks me for a password and it should not. I guess this is a problem with the
$LOGNAME variable that is not interpreted in sudoer file or somehthing like that.
I almost forgot to mention that I'm a control freak, this has to be a very strict condition, no
* or anything else tolerated.
Has anyone a solution to such a problem or should I go the painful way and allow 1 by 1 user to
cp his file to the