开发者

How to run sudo command as root?

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 o开发者_Python百科f root somehow, or make root temporarily able to use the sudo command?


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.


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.


If you are logged in as root can't you just run your command without the sudo?

ie

chmod +x /usr/local/bin/wkhtmltopdf


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


"Can I move out of root somehow?"

You could make another user account, and log into that.


Seems you simply don't have sudo installed:

command not found: sudo chmod +x /usr/local/bin/wkhtmltopdf

Just install it! sudo should be configured by default to allow being called by root without even asking for password...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜