After adding a user to sudoers, it doesn't have access to run sudo.
I'm really stumped as to what the issue is but I am running CentOs 7.9 with Plesk installed.
I have added the main Plesk subscription user to the wheel group and uncommented the following line in /etc/sudoers:
## Allows people in group wheel to run all commands
wheel ALL=(ALL) ALL
I save sudoers, and su to the user from root and any command starting with sudo just returns:
sudo: command not found
The $PATH in sudoers is as follows:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Although I have also tried the following to no avail:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/plesk/php/7.4/bin:/root/bin
I am trying to get the user in question sudo access so that they can access crontab as a cron job needs to run under that specific user (and I'm unable to get it working in the Plesk interface).
Currently, the user just gets crontab: command not found - in fact, pretty much all commands are not found (not sure if that is because these ones are all only usable for sudo users).
Can anyone advise as to what the heck I need to do to run sudo for this user? Thanks in advance. 👍
Edit for @terdon
Running grep username /etc/passwd returns the following:
username1:x:10000:1004::/var/www/vhosts/domain.tld:/usr/local/psa/bin/chrootsh
username2:x:10000:1004::/var/www/vhosts/domain.tld:/usr/local/psa/bin/chrootsh
(It is username1 that I am wanting to grant sudo access to).
Regarding the $PATH queries, I ran that after su username1 from root user. I have not modified that path, it was just like that anyway.
sudoisn't in the user's path, so you can fix it by editing the user's~/.profileand adding the PATH there, but I suspect this isn't the best way to do whatever it is you really want to do here. If you tell us what the final objective is, we might be able to find a better way.echo "$PATH"output at the command line for the affected user and where issudoinstalled on the system?grep plesk /etc/passwd(assuming the user isplesk) and then see if they have a home directory, a login shell, basic configuration files like~/.profileand~/.bashrc. I still don't get why you would need to both log in as this specific user and run sudo though. Ifpleskowns the relevant files, you don't needsudo. And if you usesudo, you don't need to be the owner of the files. What am I missing?echo $PATHreturns/opt/plesk/php/7.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/binand I assume sudo is installed in the regular place for a CentOs 7 OS...?