sudo
a particular task required that a web user (apache) write data to a text file (a majordomo email list) owned by "mail" and in group "mail" and which could only be written to by "mail".
do i change the properties of the files to be written to to allow apache to write to it? noooooo- there is a reason they have those properties and that would probably have detrimental side-effects.
do i just use the internal majordomo functions for "subscribe" and "unsubscribe" which, as a by-product, send obscure email confirmations to the email addresses? no- that is annoying.
a solution is to allow the program that needs to write to the file to run as the root user. but how can a web user assume higher privileges to be able to do this?
the linux "sudo" command.
"sudo" plus the regular command to execute the program. a line must be added in the "sudoers" file stating that a certain user is allowed to run a certain program as if he/she were root user. this file can only be manipulated by using the "visudo" command (which opens "sudoers" in vi).
having known this command when i first started on this project would have saved me days of programming up the wrong trunk. however, i am wiser for it now and will know how to tackle similar problems in the future.
do i change the properties of the files to be written to to allow apache to write to it? noooooo- there is a reason they have those properties and that would probably have detrimental side-effects.
do i just use the internal majordomo functions for "subscribe" and "unsubscribe" which, as a by-product, send obscure email confirmations to the email addresses? no- that is annoying.
a solution is to allow the program that needs to write to the file to run as the root user. but how can a web user assume higher privileges to be able to do this?
the linux "sudo" command.
"sudo" plus the regular command to execute the program. a line must be added in the "sudoers" file stating that a certain user is allowed to run a certain program as if he/she were root user. this file can only be manipulated by using the "visudo" command (which opens "sudoers" in vi).
having known this command when i first started on this project would have saved me days of programming up the wrong trunk. however, i am wiser for it now and will know how to tackle similar problems in the future.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home