I have set up a VM using turnkey linux redmine and I'm trying to SSH into the server to install some more items.

It doesn't appear to be recognizing the sudo command. Every time I try to sudo something I get an error saying:

 -bash: sudo: command not found

I read somewhere else to type 'whereis sudo' and the output was:


migrated from askubuntu.com Oct 29 '11 at 21:21

This question came from our site for Ubuntu users and developers.


It looks from http://www.turnkeylinux.org/redmine like Redmine, unlike Ubuntu, does not use sudo by default. What username are you using to SSH in? If it's root, then you don't need to use sudo, as everything you do when SSHed in to the Redmine system is done as root. If it's something else, like admin, then you could try using the su command to get a root shell in which to run commands as root.

  • What to do when script has commands sudo. Happens to me with mkusb. Its better to install sudo for future convenience . – Love Grover Jan 21 '17 at 12:59

Maybe it isn't installed? Open your package manager and install the sudo package.

  • 2
    It wasn't installed! Thanks. I'm pretty new to Linux and just assumed it was on all installations. Do i just need the sudo package or sudo-ldap as well? – Adam Oct 29 '11 at 17:14
  • 2
    You don't need the sudo-ldap package. Sudo works fine on my computer and I don't have sudo-ldap installed. – Azendale Oct 29 '11 at 17:20

try to use full path


if that command work then include /usr/bin/ in your env variable PATH in ~/.bashrc

echo "export PATH="$PATH:/usr/bin"" >> ~/.bashrc

hopefully works ..

  • 4
    That's very unlikely to be the problem; /usr/bin is almost certainly going to be in your default path. The problem, as indicated by other answers and comments, is that the sudo command wasn't installed at all. – Keith Thompson Oct 29 '11 at 22:25

First login to your root account. Then

$ apt-get install sudo

Add your existing user to group sudo

$ sudo adduser <user> sudo

You should then login as <user>, and the sudo command should be there.


The error happens because the binary you are trying to call from command line is only part of the current user's PATH variable, but not a part of root user's PATH.

You can verify this by locating the path of the binary you are trying to access. In my case I was trying to call "bettercap-ng". So I ran,

$ which bettercap-ng

output: /home/user/work/bin/bettercap

I checked whether this location is part of my root user's PATH.

$ sudo env | grep ^PATH

output: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

So sudo cannot find the binary that I am trying to call from commandline. Hence returns the error command not found.

You can direct sudo to use the current user's PATH when calling a binary like below.

$ sudo -E env "PATH=$PATH" [command] [arguments]

In fact, one can make an alias out of it:

$ alias mysudo='sudo -E env "PATH=$PATH"'

It's also possible to name the alias itself sudo, replacing the original sudo.

Please refer to this video for step by step solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy