Issue
Sudo commands will fail with Permission denied or No credential found for types [SSH Password,SSH Private Key]. Discovery logs will contain warnings like:
User has no right to run command under sudo
Release
All releases.
Cause
Some commands require sudo privileges to run. Some systems are configured to notify the admin team when a user attempts to use sudo but is not allowed to. The MID server checks if such user is allowed to use sudo with a command before the ssh commands is executed. A couple of reasons this error could be seen are:
- User is not configured to run sudo -l on the target, thus the MID server cannot determine what commands the user is allowed to run
- Command is not allowed for user given sudoers file configuration
Note: Some probes include script files. Check that such files are OOB.
Resolution
Possible solutions:
- Provide proper permissions for the Discovery user to run sudo -l command
- Update sudoers configuration to allow user to run command
- Add the mid server property "mid.ssh.disable_privilege_check" = true to disable privilege check
- sudo will be added to the command regardless of the result from sudo -l when this property is set to true
- However, user must still be able to run "sudo -l" successfully