View Full Version : [ubuntu] Sudoers File
m3bik
April 6th, 2009, 11:08 PM
I've recently tried logging into my ubuntu server. I have no problems logging in, but I can't use the sudo command anymore. I only have one user set up on the server, so I don't know what happened with it or what changed...
But when I try to sudo a command, I get the following message:
USER is not in the sudoers file. This incident will be reported.
How can I go about fixing this? Considering I can't write to certain files with out root permission....
m3bik
April 6th, 2009, 11:10 PM
Better yet, how did I become removed from the file- if only I have access to the server and I didn't do it?
cdwillis
April 6th, 2009, 11:29 PM
I don't know how it could have changed. Did you set up a password for root?
spiderbatdad
April 7th, 2009, 02:19 AM
https://help.ubuntu.com/community/Sudoers
m3bik
April 7th, 2009, 02:38 AM
https://help.ubuntu.com/community/Sudoers
Well right, but it's telling me I have to edit the file by using sudo... I can't do that, that's kind of the whole point of this question.
I only have one user account and didn't set anything for a root account because I was under the assumption I just needed to sudo everything and it would be fine. So how then, am I supposed to edit a system file without sudo or root account access?
bluefrog
April 7th, 2009, 06:55 AM
do you have physical access to the server? if yes boot in recovery mode
cdenley
April 7th, 2009, 08:49 AM
It sounds like you removed yourself from the admin group, or removed the admin group from your sudoers file.
groups
getent group admin
eldragon
April 7th, 2009, 09:10 AM
reboot from a livecd and add yourself to the admin group:
mount the root partition from your broken install...
edit /etc/group
add your username to the end of the line that says
admin:user1,user2,user3
EDIT: removed advice due to forum policy tutorial restriction. not that i agree with it ;)
cdenley
April 7th, 2009, 09:14 AM
now to avoid these kind of problems in the future, create the root account's password, make it really hard to guess. type it (with ink) somewhere in your wallet.
Or just don't mess up your permissions, and if you do, that's what recovery mode is for.
http://ubuntuforums.org/showthread.php?t=716201
m3bik
April 10th, 2009, 01:55 AM
Still not sure how it happened, but I have it fixed now. Thanks.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.