3

I am using Ubuntu 12.04 and I was doing through a terminal tutorial. There was explained about echo command and he mentioned something about adding your name to the sudoers file using echo >>. I am just wondering what it was? Can anyone tell me how to do it?

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407
Jatttt
  • 2,367
  • 12
  • 33
  • 43

1 Answers1

3

Not Recommended:

First login as root using the following command:

sudo -i

Then type:

echo "username ALL=(ALL) ALL" >> /etc/sudoers

Change username with your user name.

It will add the username to sudoers file. But doing this may lock out you from sudo.

Recommended:

If you want to edit your /etc/sudoers use visudo

sudo visudo

You can use /etc/sudoers.d instead of modifying /etc/sudoers.

For more see here.

g_p
  • 19,034
  • 6
  • 59
  • 69