How to run sudo command as root?
Solution 1
Just tried it and it worked for me
(on Mandriva Linux; other distros shouldn't be different).
Do you really have sudo
installed?
It is not by default on some distros.
Solution 2
You don't need sudo if you already are root. Just remove the word sudo.
sudo is a tool to get root access as a normal user.
Solution 3
If you are logged in as root can't you just run your command without the sudo?
ie
chmod +x /usr/local/bin/wkhtmltopdf
Solution 4
As others mentioned you normally don't need to use sudo if you are already root. But if you write some scripts or something like that and need to run it when you use root and not root users you need to put the full part to your sudo command.
You can locate where sudo app is situated running whereis sudo
from a non-root user. Normally sudo situated at:
/usr/bin/sudo
So you can write in your script: /usr/bin/sudo shutdown -h now
amaseuk
Updated on June 04, 2022Comments
-
amaseuk almost 2 years
I only have root access to my server and the sudo command therefore does not work. I am trying to run a command that tries to use the sudo command and as I already have root access, it fails.
command not found: sudo chmod +x /usr/local/bin/wkhtmltopdf
Is there a way that I can get this command to run? Can I move out of root somehow, or make root temporarily able to use the sudo command?