You are not logged in.

#1 2008-03-27 06:12:51

grndrush
Member
From: Hamilton, Ontario, Canada
Registered: 2003-12-28
Posts: 136
Website

[Solved] sudo misuse - I'm dead. in. the. water.

This certainly belongs in the n00bie corner, I readily admit. I realise exactly what I've done, I've learned my lesson, and promise to learn vi now. That said, PLEASE HELP!

1. I've gotten by just fine for years using only nano, like it, and, as implied above, never learned vi/vim(/visudo).
2. I'm trying to start using AUR (got by w/o it for years, also).
3. I installed sudo, and as was suggested, removed the root passwd. I pretty quickly decided I didn't like, and saw no real advantage to, having to enter my passwd constantly, SO...
4. I edited /etc/sudoers to (I thought) remove the requirement for a passwd. It seemed very straightforward. *I DID THIS USING NANO.*
5. I apparently screwed up step 4, above. Now, of course, I can't do ANYTHING requiring root access. I can't log in as root. I can't access sudo. I can't restore the root passwd. I can't pacman -R sudo. AFAICT, I'm hosed.

Is there any way out of this? Yes, I REALLY feel stupid. I'm in "man vi" while I wait for replies...promise.
grndrush

Last edited by grndrush (2008-03-27 06:59:23)

Offline

#2 2008-03-27 06:29:45

peart
Member
From: Kanuckistan
Registered: 2003-07-28
Posts: 510

Re: [Solved] sudo misuse - I'm dead. in. the. water.

If I had absolutely no root access, I'd boot from the install CD, mount my root partition to /mnt, and put a working /etc/sudoers file back in place.  Here's a very minimalistic one that should get you up and running:

root    ALL=(ALL) ALL
YOUR_USER_NAME ALL=(ALL) PASSWD: ALL

Good luck.

Offline

#3 2008-03-27 06:39:28

Nathan P
Member
Registered: 2008-01-30
Posts: 93

Re: [Solved] sudo misuse - I'm dead. in. the. water.

I just edited the sudoers file with nano with no problems...  but I only use it for two applications.  YMMV.

Offline

#4 2008-03-27 06:45:24

grndrush
Member
From: Hamilton, Ontario, Canada
Registered: 2003-12-28
Posts: 136
Website

Re: [Solved] sudo misuse - I'm dead. in. the. water.

Your suggestion sounds brilliant, peart. I'll report back. TIA VERY MUCH.

Offline

#5 2008-03-27 06:58:30

grndrush
Member
From: Hamilton, Ontario, Canada
Registered: 2003-12-28
Posts: 136
Website

Re: [Solved] sudo misuse - I'm dead. in. the. water.

Thanks again, peart. It worked like a charm. I now feel silly I didn't think of that myself; I guess I freaked when I lost root access. OF COURSE the CD trumps root. D'oh!

Offline

#6 2008-03-27 07:01:09

peart
Member
From: Kanuckistan
Registered: 2003-07-28
Posts: 510

Re: [Solved] sudo misuse - I'm dead. in. the. water.

LoL no probs.  Now you can run "sudo passwd root" and forget all about it big_smile

Offline

#7 2008-03-27 07:25:00

grndrush
Member
From: Hamilton, Ontario, Canada
Registered: 2003-12-28
Posts: 136
Website

Re: [Solved] sudo misuse - I'm dead. in. the. water.

That's the plan! Turns out I set the NEW line up properly, but when I went to comment out the original spec, I hit the "$" key instead of the "#", and my eyes aren't the best at 2 PM. At 2 AM, I probably shouldn't even be messing with such.  wink

Thanks again.

Offline

#8 2008-03-27 10:39:22

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: [Solved] sudo misuse - I'm dead. in. the. water.

use the -c switch.

man visudo

just don't close down nano until u have saved the edited file and run the visudo -c command in a terminal next time.

Last edited by jacko (2008-03-27 10:39:33)

Offline

#9 2008-03-27 14:59:17

lloeki
Member
From: France
Registered: 2007-02-20
Posts: 456
Website

Re: [Solved] sudo misuse - I'm dead. in. the. water.

Or make visudo use /usr/bin/nano:

From man visudo:
       There is a hard-coded list of editors that visudo will use set at com‐
       pile-time that may be overridden via the editor sudoers Default vari‐
       able.  This list defaults to the path to vi(1) on your system, as
       determined by the configure script.  Normally, visudo does not honor
       the VISUAL or EDITOR environment variables unless they contain an edi‐
       tor in the aforementioned editors list.  However, if visudo is config‐
       ured with the --with-enveditor flag or the env_editor Default variable
       is set in sudoers, visudo will use any the editor defines by VISUAL or
       EDITOR.  Note that this can be a security hole since it allows the user
       to execute any program they wish simply by setting VISUAL or EDITOR.

Search man sudoers for details about editor and env_editor


As for the recovery, note that once your root partition is mounted on /mnt you could also do chroot /mnt /bin/bash from the livecd and then passwd.

Last edited by lloeki (2008-03-27 15:06:14)


To know recursion, you must first know recursion.

Offline

#10 2008-03-27 15:11:42

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: [Solved] sudo misuse - I'm dead. in. the. water.

Throw nano away forever and learn vim! wink
I wrote a nice Quick Start guide in the wiki here: http://wiki.archlinux.org/index.php/Vim … tart_guide
Now you have no excuses.

Offline

#11 2008-03-27 16:01:28

pelle.k
Member
From: Åre, Sweden (EU)
Registered: 2006-04-30
Posts: 667

Re: [Solved] sudo misuse - I'm dead. in. the. water.

I can't remeber if nano is configured to do this with arch (i'm in ubuntu ATM) but you may do

EDITOR=nano visudo

Also, using vi for only basic editing, there is only a few things to memorize;
1. "i" to insert text, "esc" to go back to command mode.
2. in command mode, use ":" to insert a command, like "q!" to quit without saving and "wq" for write and quit.


"Your beliefs can be like fences that surround you.
You must first see them or you will not even realize that you are not free, simply because you will not see beyond the fences.
They will represent the boundaries of your experience."

SETH / Jane Roberts

Offline

#12 2008-03-28 20:31:34

grndrush
Member
From: Hamilton, Ontario, Canada
Registered: 2003-12-28
Posts: 136
Website

Re: [Solved] sudo misuse - I'm dead. in. the. water.

Thanks to all. I'd found the EDITOR via 'man vi' and 'man visudo' (I really did go straight to them after my original post, as promised smile ).

Misfit, pelle.k: I've never liked modal editors, going back to the original days of word processing, but yes I do realise that the Linux community in general has a longstanding preference (I'm trying to avoid the word 'cult' here  smile  ) for vi/vim over pico/nano. nano has served MY needs just fine for years, but I guess it's time to jump on the bandwagon. Ditto with sudo vs su. su has worked for me just fine up to now, but then I live alone, my machine's behind a firewalled router, etc; security really isn't an issue for me and I've just taken the path of least resistance.

Next up: reading your Quick Start guide for vim, Misfit. Thanks again.

Offline

#13 2008-03-28 20:58:16

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [Solved] sudo misuse - I'm dead. in. the. water.

Misfit138 wrote:

Throw nano away forever and learn vim! wink
I wrote a nice Quick Start guide in the wiki here: http://wiki.archlinux.org/index.php/Vim … tart_guide
Now you have no excuses.

Brilliant! big_smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

Board footer

Powered by FluxBB