Ubuntu – How to add a user to sudoers file

grub2sudo

How to I add my username to the sudoers file?

On my ubuntu desktop, the sudoer file has only root.

so basically, I will just need to adduser to sudo file system.
And I need to access to single user mode.

I know the easiest way to to just select recovery mode in grub by hold down left Shift when booting. Then Drop to root shell prompt.

But it is ready-only file system. I need to write myself to the file.

I know I have to select remount first, but where is it?

and any other way to add myself to sudo?

Best Answer

Sounds like a bit of a predicament you're in. If you've given your root account a password, su may allow you to elevate privileges and add your user to the group "sudo" or "admin".

If not, have you tried running a live CD? You should be able to mount your root partition from the Ubuntu live CD fairly easily, say to /mnt/tmproot/, and add this line somewhere in /mnt/tmproot/etc/sudoers:

username ALL=(ALL) ALL

where "username" is whatever your username is.

Related Question