i want to install a software in my linux machine staying in another user that i have created .It is asking for root access for some command to be execute during installation process.when I am trying to execute "sudo -s" its showing " is not in the sudoers file. This incident will be reported.".what next will i do.I am in my ubuntu machine.
-
1This question would be a better fit for superuser.com– Dan JSep 20, 2010 at 16:01
-
or ubuntu.stackexchange.com or unix.stackexchange.com– RupSep 20, 2010 at 16:02
-
2Does this answer your question? How can I add a regular user to the sudoers file?– G-Man Says 'Reinstate Monica'Dec 11, 2019 at 2:07
4 Answers
In general you don't want to edit /etc/sudoers
every time you add a new user. All administrators are given sudo access by default, so you just want to give that user permission to administer the system as outlined here. This adds the user to the admin group.
The only time you want to edit /etc/sudoers
is if you need more finely grained access than administrator or not, such as a user you want to be able to install new software, but not restart the web server, for example. Also, on the rare occasion you do want to change /etc/sudoers
, you don't want to just edit it directly. You need to use the visudo
command.
It looks like you've messed up your system, or created a new user without modifying the /etc/sudoers
file.
Login with an account you made when you've installed Ubuntu. Open up a shell, and type: sudo nano /etc/sudoers
.
Search for these lines:
# User privilege specification
root ALL=(ALL) ALL
Add an additional entry below that, like yourusername ALL=(ALL) ALL
.
You should log in as root and edit that user into the sudoers file, /etc/sudoers
. Try man sudoers
for the full file format documentation, or there should be helpful comments inside the file.
May be not the best solution but it could helps.
Try this as root:
# usermod -aG sudo username
The change will take effect the next time you log in