Why am I unable to run sudo commands on my EC2 Linux instance

0

Hello All, After downloading Maven Zip and unzip i tried to make PATH Variable environment for Maven by adding it in /etc/profile I have given the below commands:- Vi /etc/profile export Path=$Path:/opt/apache-maven-3.9.2/bin :wq exit After i tried to enter into root user by giving sudo su- command but i was not able to run that command its giving error -bash: sudo: command not found.

Please suggest.

Thanks,

Monica
posta un anno fa862 visualizzazioni
1 Risposta
2
Risposta accettata

Hi,

Sometime it doesn't find path to sudo ie. /usr/bin/sudo. Try running "/usr/bin/sudo su -", if it doesn't work and you don't find sudo file at /usr/bin/, then please install sudo as below:

apt install sudo

Then, add your user to the sudo group using:

usermod -aG sudo your_username

You should be able to use sudo now.

If the answer is helpful, please click "Accept Answer" and upvote it.

PS: One thing, which I noticed is, there was no space between "su" and "-" in your question, I believe, that's just typo.

profile pictureAWS
ESPERTO
con risposta un anno fa
profile picture
ESPERTO
verificato 10 mesi fa
profile picture
ESPERTO
verificato 10 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande