Results 1 to 3 of 3
Hi.
I want to allow user1 to change to user2 with no password guestions. What I have to write into sudoers file?
backgrounds:
I have a program. User1 start to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-07-2007 #1Just Joined!
- Join Date
- Apr 2007
- Posts
- 13
How to (sudo or su) to another user
Hi.
I want to allow user1 to change to user2 with no password guestions. What I have to write into sudoers file?
backgrounds:
I have a program. User1 start to run it. In the halfway on program there is function which references into files which user2 owns. I would like change to user2 before we execute this function.
I have this command before function:
system("sudo su - user2");
But now I don't know what I should write into sudoers file?. program always ask me to write password when I program executes this system command.
I have tried to write this in my sudoers file, but this wont work. It still ask's me to write password
[B]user1 machine = (user2) NOPASSWD:ALL[B]
Please help.
- 05-07-2007 #2
What you are trying to do is very complicated. Why not just create a new group. After that put user1 and user2 into that group and then change group ownership of the files (the ones referenced in your script) so that they are owned by the new group. After that change the permissions on these files so that the new group has at least read permissions. user1 should then be able to read those files.
- 05-08-2007 #3Just Joined!
- Join Date
- Apr 2007
- Posts
- 13
Yes, You are right.
It is much easier to use groups.
Thanks daark.child


Reply With Quote
