I have just installed an application on my Amazon EC2 instance called sshpass. I am having trouble getting it to work properly ( although, it works correctly on a non AWS instance ). I've read in some forums that I may need to run it as the root user for it to work properly.

On an AWS instance, I must run applications with sudo to run them as the root user. When I try to execute sshpass with sudo sshpass bash outputs 'command not found.'

Where & how do I configure sudo so that I can run sshpass as root using sudo?


Give the full path to the command.


sudo /opt/local/bin/sshpass

Obviously this isn't intended to be an accurate guess as to where you may have put it.


If bash prints "sudo: command not found" then sudo is simply not installed in your system. You may use su -c sshpass instead of sudo.


Depending on the type of image (Amazon Linux, Ubuntu, Suse, CentOS, Debian, etc...) you could find out the path where the files are installed, and run them, I assume the reason for this is the fact that the application is in /sbin or /usr/sbin and not in the default path of the non-root user.

To find the location of the files in RPM based distributions (such as, RedHat, Fedora, Amazon Linux, Suse and CentOS):

rpm -ql <your package name>

For Deb based distributions (Ubuntu, Debian) use:

dpkg -L <your package name>

In the listing you should be able to see the binaries in a path ending in bin or sbin.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.