sudoers file
You should be able to do this, I think you're encountering a quoting/spacing issue in your definitionany of the command sudoedit /path/to/filethese.
Such as this:
john ALL=(ALL) NOPASSWD: sudoeditor this:
john ALL=(ALL) NOPASSWD: sudoedit /path/to/fileLastly you could do it like this too:
Cmnd_Alias SOMECMD = sudoedit /path/to/file john ALL=(ALL) NOPASSWD: SOMECMD
For starters I'd try just thisOnce you have one of these definitions in place you invoke it like so:
john ALL=(ALL) NOPASSWD:sudoedit /usrpath/binto/sudoeditfile
Details
If this works then I'd tryYou don't need to invoke it with a sudo command prefix like this:
Cmnd_Alias SOMECMD =sudo /usr/bin/sudoedit /pathpat/to/file
john It takes care of the sudo automatically. It's equivalent to sudo -e /pat/to/file which will invoke an editor with elevated privileges.
excerpt from the sudo/sudoedit man page
-e ALL= The -e (ALLedit) NOPASSWDoption indicates that, instead of running a command,
the user wishes to edit one or more files. In lieu of a command, the
string "sudoedit" is used when consulting the sudoers file. If the
user is authorized by sudoers the following steps are taken:
SOMECMD 1. Temporary copies are made of the files to be edited with the
owner set to the invoking user.
2. The editor specified by the SUDO_EDITOR, VISUAL or EDITOR
environment variables is run to edit the temporary files.
If none of SUDO_EDITOR, VISUAL or EDITOR are set, the first
program listed in the editor sudoers variable is used.
3. If they have been modified, the temporary files are copied
back to their original location and the temporary versions
are removed.
You can override the editor by setting one of the environment variables mentioned above with the name of an editor to use such as vim or gedit, for example.