![]() The principle of an example is to help the understanding, not to be excuse to simplify the answer of the general problem. My script has a lot of commands (with some cd to root-access-only config files), and the solution can't be "Well, just do it directly with apt-get". I want to insist on the fact that this "apt-get update" was just an example FAR from whhat my script actually is. For reference, I'm leaving my previous answer: If you add a line of the form wheel ALL (ALL) NOPASSWD: ALL to /etc/sudoers (using the visudo command, of course), it will let everyone in the group wheel run any commands without providing a password. This post is then for helping people having this problem and searching for the same solution (I didn't find a good post on it), and perhaps have better solutions coming from you guys. to allow all users to run all commands without a password. But I am not truly satisfied of this solution, particularly by the fact that I have to use 2 scripts for every command. So, ok, I create another script script2.sh as following : script2.sh Well, so I say to myself "Ok, that means that if I have a file refered in sudoers as I did, it will work without prompt only if I call him with sudo, what is not what I want". (I think I didn't fully understand the difference)īut this doesn't solve my problem if I don't use sudo to execute this script : #. Then I added to my sudoers file (at the end to override everything else) : user ALL=(ALL:ALL) NOPASSWD:/path/to/script.shīy the way, I also tried the line : user ALL=(ALL) NOPASSWD:/path/to/script.sh Of course, if I execute this script, I get a prompt asking me for a password. I saw as the only solution to put sudo INSIDE script.sh. For some reason I need, as user, to run without sudo a script script.sh which needs root privileges to work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |