I know that that line above allows <user> to run sudo command without having to type in the password. But what does the syntax actually mean? If you can link to an article then that would be fine too. Thanks
Asked
Active
Viewed 4.4k times
8
Nabeel Parkar
- 217
2 Answers
8
The sudoers man page describes this in great detail.
The format is;
user_spec host_spec=(runas_spec) NOPASSWD:cmd_spec
- user_spec identifies which users can use the rule.
- host_spec identifies which hosts the rule applies to. This is optional and defaults to ALL.
- runas_spec identifies which users the commands can be run as.
- NOPASSWD: or PASSWD: specifies whether a password is required. This is optional and defaults PASSWD unless the default has been changed in sudoers configuration.
- cmd_spec identifies which commands the rule can be run for.
It is common to use aliases for various specs. Each spec has a predefined alias ALL, which is self-explanatory.
3
From man sudoers
By default, sudo requires that a user authenticate him or herself before running a command. This behavior can be modified via the NOPASSWD tag
So users or groups are able to run sudo without authenticating. This makes it a big security risk so be very careful with this command.
Also check https://askubuntu.com/questions/334318/sudoers-file-enable-nopasswd-for-user-all-commands
Erjen Rijnders
- 366