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
已提問 10 個月前檢視次數 859 次
1 個回答
2
已接受的答案

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
專家
已回答 10 個月前
profile picture
專家
已審閱 10 個月前
profile picture
專家
已審閱 10 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南