views:

130

answers:

6

Hello, 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?

A: 

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

ie

chmod +x /usr/local/bin/wkhtmltopdf
espais
It is part of a script i.e. pdfkit --install-wkhtmltopdf
aaronmase
+2  A: 

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.

Alexander Kjäll
I am unable to remove the word sudo as it is embedded in the script somewhere
aaronmase
Then you can install the sudo program, how you do that is depending on what distriution you have, on ubuntu or debian you would do it like this:apt-get install sudo
Alexander Kjäll
That's what I just did and it worked :)
aaronmase
+1  A: 

Just tried it and it worked for me (at least on Mandriva Linuc, but don't think other distros should make a big difference).

Do you really have sudo installed? It is not by default on some distros.

TheCandyMan666
I always log in as root and so I don't know if sudo is installed. Do I need it if I am root, and will it deal with it properly?
aaronmase
Well done! I just installed sudo and it worked :)
aaronmase
There shouldn't be a problem if you are root and still using sudo. So good to hear its working. And please accept answers if they helped ;)
TheCandyMan666
Thanks for your help
aaronmase
A: 

"Can I move out of root somehow?"

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

Merlyn Morgan-Graham
A: 

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...

Mr Shunz
A: 

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

andrii
Thanks for your understanding and for your tip
aaronmase