Sudoers problem
Hello.
What I want: To be able to use sudo <cmd> without password prompt. What I did: This is the content of my sudoers file: Code:
Defaults env_reset Code:
$ id mmilic Alternatively, I tried to do the same thing with expect.My idea was to create script that will automatically put password if sudo session is over. If I call that script refresh_sudo, I would then be able to use this in my shell scripts in this way: Code:
#!/bin/bash Code:
#!/usr/bin/expect -f I appreciate any help. Thanks. |
It is strongly discouraged to allow any user to operate sudo without a password, including yourself. Note - if you do a lot of sudoing in one go, you need your password only the once for the sudo session anyway.
You con increase the timeout period if you want - but remember to explicitly kill the session after. There is often sudo su - to get you a root shell. If you find yourself routinely running commands that you need scripts to handle them, consider organizing things so they can be run as cron jobs. Similarly for scripts - let root run root scripts - not users. You have a world-class secure OS there, please do not dismantle the very features keeping all of us safer. Look for another way to acheive your ends. Thanks. Back to your question: In what way are the changes you made "not working"? (eg. Can you still use sudo - but still need a password, or can you not sudo at all now?) Did you logout/login after making the changes? |
Quote:
Quote:
I think I did restart the system, but I am not sure. I will check it out again and post it here if that fixes the problem. I didn't know you need to logout for this to take effect. About exp script it always asks for password, even if run multiple times. Actually, since automation is one of my primary ways of expression, I would really like to know what is the problem with exp script and to see version that works. I already explained what I am trying to achieve - refresh_sudo when called will either return if sudo session is still active or open another sudo session if not, by automatically filling in password. Thanks |
All times are GMT -5. The time now is 03:23 AM. |