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 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则