LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   "Command not found" on my server? “bash: sudo: command not found”? (https://www.linuxquestions.org/questions/linux-server-73/command-not-found-on-my-server-%93bash-sudo-command-not-found%94-4175562483/)

MilesOfRoses 12-27-2015 09:06 PM

"Command not found" on my server? “bash: sudo: command not found”?
 
I'm trying to get my server setup so that I can deploy my first rails app, but when I log into my server via SSH on the command line and try to run this command:

Code:

milesros@serv01 [~]# sudo adduser myappuser
I keep getting this error:

Code:

-bash: sudo: command not found
It looks like the server isn't responding to the 'sudo' command. however, if I omit 'sudo' and just type the command:

Code:

milesros@serv01 [~]# adduser myappuser
I'm greeted with this error instead

Code:

-bash: adduser: command not found
It seems like a number of crucial commands are not being recognised by my server's command line (even 'apt-get'!)

I was able to run the command
Code:

compgen -c
from my server to get a list of all the available commands, but I didn't see sudo adduser apt-get etc. (though there was still a long list of commands, I could post them if it would help)

The commands seem to work just fine when I'm entering commands on my local machine, but as soon as I log into the server, I keep getting 'command not found' errors.

I'm running Ubuntu 14.04, and my hosting is with SiteGround (their servers run linux CentOS)

Also, if it helps I have been following this tutorial on deploying a rails app by Phusion Passenger up to this point https://www.phusionpassenger.com/lib...eploy_app.html

Any tips or advice would greatly appreciated, I've been at this for hours :(

astrogeek 12-27-2015 09:18 PM

What you are running locally does not matter. Only the server OS and configuration matter.

What type of hosting account do you have? Shared, dedicated server, VPS? Do you have root access? Etc., etc...

Have you checked the provider documentation?

MilesOfRoses 12-27-2015 09:35 PM

I have a shared hosting account with SiteGround, but since it's a shared hosting plan, I don't have ssh root access to the server. I have gone through the Phusion Passenger documentation, but haven't found a solution yet. Actually, the tutorial that I've been following up to this point is actually part of Phusion's documentation.

astrogeek 12-27-2015 10:06 PM

Quote:

Originally Posted by MilesOfRoses (Post 5469751)
I have a shared hosting account with SiteGround, but since it's a shared hosting plan, I don't have ssh root access to the server. I have gone through the Phusion Passenger documentation, but haven't found a solution yet. Actually, the tutorial that I've been following up to this point is actually part of Phusion's documentation.

Well, on a shared hosting plan you are almost certainly not going to have sudo, nor the ability to add users, nor any sort of server admin access such as ability to install packages, etc. Whatever your tutorial says probably assumes that you do have root access, so it will probably not be applicable to your SiteGround platform.

ondoho 12-28-2015 03:24 AM

^ and i fear that is all there is to it.

but for the sake of completeness:
- you don't need sudo. try 'su' instead (just 'su', not adding any command after that. it should ask for your root password, which is not the same as your user password)
- the '#' prompt kinda implies that you are root already. enter "whoami" to see who you are.
- CentOS does not use apt-get, because apt-get is debian specific.

Habitual 12-28-2015 08:22 AM

Trust us, Shared Hosting accounts do not get "root".
Contact Siteground support.

273 12-28-2015 08:52 AM

I feel I should also pint out that "apt-get" is a Debian program and won't work under CentOS which would use YUM or, at some point, DNF.
It might be as well to read up on Linux distributions if you're going to be spending money on running one.

Coop31 04-01-2016 09:19 AM

If you are running Debian or Ubuntu and would like to run any command with the Sudo and got an error '-bash: Sudo: command not found' , you probably have no sudo pre installed. To solve the issue create a superuser and enter the 'su' command in shell script. Then you enter the password of the root and continue running the command but with root privileges: 'apt-get install Sudo'
Everything should work upon completion.

IMPORTANT: For the current user to execute commands with root privileges using Sudo he/she must be a member of the corresponding group. To add a user to the sudo group, run the following command: 'usermod -a -G sudo user*'
*('user' is an actual user name)
More on such specifics can be found here


All times are GMT -5. The time now is 04:19 AM.