User permitted to run command,execute program as root and after execution, exit root
when a command is typed(i.e. /path/to/the/program), as a normal user, he should be able to run that command , execute that program as ROOT and log out root after the execution is completed.
Only one user should be able to do it. Hence, I have created a new user vj and added the following command in visudo: Code:
vj ALL=(ALL) NOPASSWD: /path/to/the/program What I need is that the program which is been called must run as if it is run by a root user,and when the program is completely executed, exit the root user. How do I proceed? |
that is the command sudo:
sudo /path/to/the/program That's why you used visudo to modify configuration. |
Quote:
The user vj has no rights to execute them. So, do I explicitly have to allow the user to execute the n number of commands? |
Quote:
|
I have called "ifup eth0" in the program, and it gives me an error
Quote:
|
you have to call the program using sudo:
Code:
sudo ifup eth0 |
So, it means that if I add the user to visudo and then run it, it should not give me an error.
Adding it to visudo is as good as writing sudo before the command right? |
vi is an editor, visudo means edit the configuration file of sudo (see: man visudo).
"Adding to visudo" is exaclty the same as "writing sudo rights". |
Quote:
|
But when I add this command to the visudo it gives me an error :(
Quote:
Quote:
|
@TobiSGD I think I got it. U mean that I should add ifup and ifdown in viduso and should write sudo /sbin/ifup in the program where I am calling it right?
|
Quote:
|
It's working.. thankyou :)
|
All times are GMT -5. The time now is 01:46 AM. |