1

I have an ubuntu account but i do not have sudo access, I did try sudo usermod -a -G username to give me sudo access but I am getting username is not a sudoer file, this will be reported. To get a sudo access to an existing account what do I need to do ?

pl_rock
  • 11,297
Chauhan
  • 11

1 Answers1

3

login with root user using

 su - root 

then run command

usermod -a -G sudo username

or

run command visudo and paste

username ALL=(ALL) ALL

if still you face problem then run command

 mount -o rw,remount /

and try again above method

also, you are saying. you able to run command

sudo adduser chauhan sudo 

then you can do this way also

su - chauhan
sudo usermod -a -G sudo username
pl_rock
  • 11,297
  • Since I do not have sudo access I can not login root ! I am asking about existing account @pl_rock – Chauhan Aug 20 '15 at 06:51
  • yes I know , I did groups username and I can not see sudo access. – Chauhan Aug 20 '15 at 06:56
  • yes that was not working now i am in recovery mode and loged in to root, I tried usermod -a -G sudo username and I am getting usermod: cannot lock /etc/passwd try again. – Chauhan Aug 20 '15 at 07:03
  • mount -o remount,rw / worked out and after that sudo adduser chauhan sudo is also working fine – Chauhan Aug 20 '15 at 07:24
  • @Chauhan: could you delete your comments as well and don't forget to click the grey at the left of this text, which means Yes, this answer is valid! ;-) plrock: upvoted! – Fabby Aug 22 '15 at 15:16