11/27/2023 0 Comments Arch sudo without passwordPlease report if you experience issues with that answer. This is done through cmd-aliasing and specifying SHA-sums in /etc/sudoers.d/60_my-user_rules. In that case the rule will apply only for that/those exact parameter(s).įor scripts, you could further harden this rule by ensuring that the rule applies only if the script was not modified in any way. You can harden this rule by specifying the optional parameter(s) to that command. This will actually restrict yr passwordless sudo disposition to one user, one host and one command. In that case, the rule becomes: my-user my-host = () NOPASSWD: /full/path/to/cmd ]] You may however want to not only run your cmd/script with root privilege but also run it as either a given user ( spec-user) or as a member of a given group ( spec-group) or both. I've not seen it before with interspersed space and yr rule becomes: my-user my-host = NOPASSWD: /full/path/to/cmd ]]Īdding (ALL) before the NOPASSWD: is optional as the rule defaults to (ALL:ALL) anyway. etc/sudoers.d/60_my-user_rules), make the colon stick to the tag, i.e. Sometimes running a process from root's crontab may cause issues with initial file ownership and rwx mode those may not be correctly preserved.ġ) to create a new user, keep it simple: $ sudo deluser my-user # if "my-user" is a regular userĢ) to include a new entry with a NOPASSWD tag in sudoers or in a file (e.g. PS: I seen this question, but I'm not able to make it working so I need a more precise explanation, because my situation is different: i'm running a crontab script and I need it do not ask for sudo password Please tell me if some steps/lines were not needed and how to make able my-user to execute sudo without password request. I really need to execute the script in this way to be able to create file with my-suer as owner. In fact, the crontabbed script crashes telling me in the log about a sudo request of password. NOTE: I've added the crontab using crontab -e my-user so I suppose my script is executed as my-user. Then using visuo i added this line, based on this question my-user ALL=(ALL) NOPASSWD : ALLĪfter reboot I logged in using my-user and tried to do sudo clear, but it ask me the sudo password. Add users to a group with the gpasswd command (see FS58262 regarding errors): gpasswd -a user group. Note: If the user is currently logged in, they must log out and in again for changes to take effect. Create new groups with the groupadd command: groupadd group. I created a new user on my ubuntu server 16.04 圆4 adduser my-user sudo To list all groups on the system: cat /etc/group. I need that a new user could execute sudo without any request of password, because this user has in crontab a.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |