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?

  • You have to write the command by hand. mount -o rw,remount / and be carefull what are you doing because you can screw up your system easily (as root).
    – NickTux
    May 16, 2013 at 14:38
  • it says, mount: special device remout does not exist. since Ubuntu 12.10, remount menu is not there on recovery mnenu.
    – Jin Lin
    May 16, 2013 at 14:43
  • There is no remount menu. First boot from advanced options -> Recovery Mode and then select root. There you must give the command I wrote above. Also be careful with the syntax. It seems like you made a mistake with the command
    – NickTux
    May 16, 2013 at 14:50
  • I've answered your question based on the your wanting to add yourself to sudo. However, I am having difficulty trying to understand what you want to do. May 16, 2013 at 15:00
  • I did the command under etc path. but the file sudoers is still read-only. as there is only root on sudoers path. How do I add my username to sudoers?
    – Jin Lin
    May 16, 2013 at 15:11

2 Answers 2


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.


If your user name is as an example jlin, you should be able to sudo, if you entered your name as the sudo user when you installed Ubuntu.

If you want to add another user or if your username did not install Ubuntu, then you must log in as that user who installed Ubuntu, enter sudo -i to get root prompt; and then enter this command visudo.

I usually add the users I want to have sudo access. You can also add a group to have sudo access. I prefer just adding the users. I added a space in between the following, so it would format better.

# User_Alias ADMINS = jsmith, mikem

dbadmin ALL=(ALL) ALL

You can also use this command (as root)

sudo usermod -a -G sudo hduser

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.