Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-10-2012, 12:18 AM
|
#1
|
Member
Registered: Apr 2011
Posts: 31
Rep:
|
Messed up sudo in Ubuntu
Greetings,
I just installed Ubuntu on an old laptop and began the process of creating a user account for me and my girlfriend. Apparently Ubuntu doesn't come with a root password and ships instead with one standard account with sudo privileges.
I needed sudo privileges for my account as well so I edited /etc/group and added my username to the admin group. I fudged the line and left out the trailing colon that should be at the end of the entries - This has rendered the system useless when trying to do anything privileged because neither accounts have access to sudo anymore...lol.
Is there a way to fix this?? Thank you!
|
|
|
05-10-2012, 12:38 AM
|
#2
|
Member
Registered: Apr 2012
Location: Russia
Distribution: Slackware64-current
Posts: 272
Rep:
|
Hi, I think it is following steps:
Boot any LiveCD/DVD/FlashDrive, then:
Code:
# mkdir -pv /mnt/ubuntu
# mount /dev/sda5 /mnt/ubuntu
# nano /mnt/ubuntu/etc/group
# nano /mnt/ubuntu/etc/sudoers
Where are /dev/sda5 is a partition with your rootfs.
|
|
|
05-10-2012, 05:45 AM
|
#3
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
Like yars said. For future use, if you use commands like usermod and visudo you don't have to edit the configuration files manually and can't mess up the system with typos.
|
|
|
05-10-2012, 06:08 AM
|
#4
|
Senior Member
Registered: Dec 2011
Location: Michigan USA
Distribution: OpenSUSE 13.2 64bit-Gnome on ASUS U52F
Posts: 1,444
|
you can type a combinations of commands and that would work too.
something like
Or you can use the users and group tool on the GUI
Good luck to you!
|
|
|
05-10-2012, 08:35 AM
|
#5
|
Member
Registered: Apr 2012
Location: Russia
Distribution: Slackware64-current
Posts: 272
Rep:
|
Quote:
Originally Posted by TobiSGD
Like yars said. For future use, if you use commands like usermod and visudo you don't have to edit the configuration files manually and can't mess up the system with typos.
|
+1. In addition, it is as far as I know, blocking access to files at the time of your experiences with them, that positively affects your safety.
|
|
|
05-10-2012, 04:15 PM
|
#6
|
Member
Registered: Jun 2011
Location: Tehran, Islamic Repulic of, Iran
Distribution: Ubuntu, Arch, Suse
Posts: 32
Rep:
|
Yah. You are right. By default, your account has not sufficient privilege to execute administrative command like that.
In first step we can activate root account by setting up a password:
If you cant do this, we can edit suduers file at "sudo vi /etc/sudoers" location:
Code:
<your_username> ALL=(ALL:ALL) ALL
after adding this line and save file,
again execute this:
after setting password up, you can use su to login as a root user to do what you would.
If not, Just add your username like up to sudoers file to be able execute any command(ALL) by sudo in your normal user.
Last edited by Erfankam; 05-10-2012 at 04:45 PM.
|
|
|
05-10-2012, 04:59 PM
|
#7
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
Quote:
Originally Posted by Erfankam
Yah. You are right. By default, your account has not sufficient privilege to execute administrative command like that.
In first step we can activate root account by setting up a password:
If you cant do this, we can edit suduers file at "sudo vi /etc/sudoers" location:
Code:
<your_username> ALL=(ALL:ALL) ALL
|
If the user can't run sudo su the he will also not be able to run sudo vi, which is by the way not the recommended way to edit /etc/sudoers, the recommended way is to use visudo.
|
|
|
05-10-2012, 05:11 PM
|
#8
|
Member
Registered: Jun 2011
Location: Tehran, Islamic Repulic of, Iran
Distribution: Ubuntu, Arch, Suse
Posts: 32
Rep:
|
Quote:
Originally Posted by TobiSGD
If the user can't run sudo su the he will also not be able to run sudo vi, which is by the way not the recommended way to edit /etc/sudoers, the recommended way is to use visudo.
|
TobiSGD, Thanks for your notation.
Yah, But sometimes just some of commands in sudoers file is restricted. I think one of them was passwd.
Ok, If Tobi is right and you dont have any access to sudo commands, use a live distro to boot up and edit sudoers file by that to add all commands to it like up.
|
|
|
All times are GMT -5. The time now is 10:47 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|