PDA

View Full Version : Sudo list.



rrfish72
08-05-2004, 01:43 AM
How do I add myself to the sudoers.

Stephen
08-05-2004, 02:26 AM
How do I add myself to the sudoers.

As root visudo then use the examples in the file for your guide.

mzilikazi
08-05-2004, 02:56 AM
Aw cmon Stephen are you gonna punish the noobs w/ vi? :) vi is about as friendly as a coiled rattlesnake! You don't have to use vi you can use any editor you want. ;)

su
<passwd>
xedit /etc/sudoers

Stephen
08-05-2004, 03:23 AM
Aw cmon Stephen are you gonna punish the noobs w/ vi? :) vi is about as friendly as a coiled rattlesnake! You don't have to use vi you can use any editor you want. ;)

su
<passwd>
xedit /etc/sudoers




# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#


Not according to that ...

mzilikazi
08-05-2004, 04:20 AM
Well I don't even have vi on my Linux boxen but I'm a sudoer! OK so I'm a rebel. :P

Durand Hicks
08-05-2004, 11:49 PM
Me too! I purged vi because, I couldn't figure that editor out. How anyone ended up liking vi as an editor is beyond me, that is the most unfriendly, unintiutive editor I have ever laid eyes on. Perhaps the warning could have said that it can be edited in a straight ascii editor such as nano, mcedit, ... you get the idea, as long as it is anything but vi.

Stephen
08-06-2004, 01:16 AM
Me too! I purged vi because, I couldn't figure that editor out. How anyone ended up liking vi as an editor is beyond me, that is the most unfriendly, unintiutive editor I have ever laid eyes on. Perhaps the warning could have said that it can be edited in a straight ascii editor such as nano, mcedit, ... you get the idea, as long as it is anything but vi.

The warning is there because when using the visudo it locks the file and prevents any other editing access to it for as long as you have it open this is the same reason vipw exists as well. Oh and BTW you were using VIM (vi improved) not VI if you think it was bad you should try the real thing.

CrashedAgain
08-06-2004, 02:22 AM
Me too! I purged vi because, I couldn't figure that editor out. How anyone ended up liking vi as an editor is beyond me, that is the most unfriendly, unintiutive editor I have ever laid eyes on. Perhaps the warning could have said that it can be edited in a straight ascii editor such as nano, mcedit, ... you get the idea, as long as it is anything but vi.

The warning is there because when using the visudo it locks the file and prevents any other editing access to it for as long as you have it open this is the same reason vipw exists as well. Oh and BTW you were using VIM (vi improved) not VI if you think it was bad you should try the real thing.

I never understood why this warning was there before. I've long since edited it out.

Personally I use Kate, I have a RootKate icon on the desktop. Just drag'n'drop the Kate icon from the start menu & edit to run as root...with KDE3.2 this is in 'advanced application' properties setups. Anyway, I highly recommend using Kate for newbies unfamiliar with CLI editors.

For CLI editor I use 'joe' (Ms Cuddles favorite app javascript:emoticon(':lol:') just because it's an interface I'm familiar with from a long time ago in the land before Windows or Linux.

Markus
08-06-2004, 08:24 AM
Is this where you post your favorite editor? :D

I think visudo also refuses to save the file if you've made a mistake in the syntax, or at least tells you about the mistake.
That said, I once ran vimtutor and the next command was apt-get install nano.

rrfish72
08-06-2004, 08:55 AM
So how do I add to the llist? I don't know how to edit the list because I can't find it. Help?

baldyeti
08-06-2004, 09:40 AM
First open a console, and become root by typing "su -", then the root password. Then "mcedit /etc/sudoers" should do.

Oh, and removing vi from a unix-like system for the sake of reclaiming a few tens of kilobytes is just plain silly.

edit: Actually visudo seems to be compiled with alternative editor support enabled on debian, so "EDITOR=mcedit visudo" works, and locks/validates the sudoers file like it should. Neat.

champagnemojo
08-06-2004, 10:05 AM
C'mon, VI isn't so bad for things like this. I won't claim to be an expert on it, but I can view or fix my files with it and quit with or without saving...which is all you really need for simple editing like this. And you can learn to do those things in 10 seconds. I'd never choose it over a graphical text editor (of which I usually use KEdit...because it's simple and loads instantly), but when I'm outside of X I use VI.

mzilikazi
08-06-2004, 01:22 PM
So how do I add to the llist? I don't know how to edit the list because I can't find it. Help?

You have to be root to edit the file:

su
<passwd>

Then use any editor you like:

xedit /etc/sudoers

You'll need an entry like this:

username ALL=(ALL) ALL

OR for passwordless sudo (kind of a security risk)

username ALL = NOPASSWD: ALL

Just add one or the other entry. You do not need both.

Durand Hicks
08-06-2004, 01:44 PM
Baldi,

Where were you when this thread started? If I had known about editing visudo to use mcedit or nano, I wouldn't have a reason to rant about vi (or vim, as Stephen pointed out). Is there any chance this thread can be made into a sticky for newbies?

Btw, I didn't remove vi for space reasons, I removed it because I hated it and won't use it at all.

Stephen
08-06-2004, 07:29 PM
So how do I add to the llist? I don't know how to edit the list because I can't find it. Help?

Well the Knoppix file looks different than this IIRC.



# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL
stephen ALL=(ALL) ALL


To edit the file you use the already mentioned visudo. Now when the file opens you use the down arrow to get to the "User privilege specification" section then you hit the INSERT key type in a line similar to mine except using your user name at the start then when done use the SHIFT and ; keys at the same time which results in a : appearing in the lower left of the console/console widow now you would type in wq then enter key to write and quit the file now you are done.

baldyeti
08-06-2004, 08:39 PM
If I had known about editing visudo to use mcedit or nano, I wouldn't have a reason to rant about vi
Setting the environment variable EDITOR in your .profile is an old unix convention. A few command line programs will use what it points to (instead of the default vi) when they need to call an external editor. I know visudo, vipw, "crontab -e", mailx ... will follow that convention.

Stephen
08-06-2004, 09:18 PM
If I had known about editing visudo to use mcedit or nano, I wouldn't have a reason to rant about vi
Setting the environment variable EDITOR in your .profile is an old unix convention. A few command line programs will use what it points to (instead of the default vi) when they need to call an external editor. I know visudo, vipw, "crontab -e", mailx ... will follow that convention.

If you want to change the default in Debian you can use update-alternatives --config editor.

markb
08-07-2004, 12:37 AM
How anyone ended up liking vi as an editor is beyond me, that is the most unfriendly, unintiutive editor I have ever laid eyes on.
Vi is completely inappropriate for a newbie editing a one-off file once every 3 months. We all agree with that and that is why Linux offers so many simpler alternatives. However, for a professional programmer who lives in an editor most of the day, vi (nowadays vim) is a killer app. I create entire beautiful worlds in vim quicker than you can type in your editors name! Vim is the ultimate conduit between my brain and the computer. Don't knock my vi! :)

rrfish72
08-07-2004, 11:22 PM
Used mcedit to make changes. Thank You.

mzilikazi
08-08-2004, 04:14 AM
Used mcedit to make changes. Thank You.

A fine choice of editors! :) You'll find that mc (midnight commander) is capable of so many things including easy file transfer through ftp & ssh. You can also play mp3's & .ogg's, execute files, create and delete directories etc. Anything you can do with a graphical file manager can be done w/ mc (well ok not d&d :) )