LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 11-13-2008, 04:14 PM   #1
annihilan
Member
 
Registered: Jul 2008
Posts: 58

Rep: Reputation: 15
Adding a user to the sudoers file?


I know how to add the user to the file basically, but how can I set this for a more or less normal user, with normal privileges and that I sudo to install and such? I have NO idea how to use vi, seriously it hurts my head.
 
Old 11-13-2008, 04:22 PM   #2
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,553

Rep: Reputation: 120Reputation: 120
You can always create a sudoers file under your normal user account and then copy it in /etc (as root)
Just an idea though
 
Old 11-13-2008, 04:25 PM   #3
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by annihilan View Post
I know how to add the user to the file basically, but how can I set this for a more or less normal user, with normal privileges and that I sudo to install and such? I have NO idea how to use vi, seriously it hurts my head.
Don't use vi, the proper way is to use visudo command to edit sudoers. It'll prompt if you make mistakes and it also locks the file while it's being edited.

vi is easy though, here are some of the basics:

i = insert mode (edit mode)
esc = command mode

x = delete present character
dd = delete whole line
dw = delete current word
o = start new line for editing from present line
a = start editing one character to the right

wq = write and quit
Shift+ZZ = write to the file and quit
 
Old 11-13-2008, 04:26 PM   #4
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 1,913

Rep: Reputation: Disabled
The sudo package shipped in Slackware right now doesn't seem to respect VISUAL or EDITOR from the environment - see visudo(8) and the configure flags used in the build script for why

In other words, learn to use vi :-)

EDIT: Pat just pointed out my oversight in the man page :/
I'm leaving the above text here though, as I don't much like to cover up errors :-)

From visudo(8):
Quote:
There is a hard-coded list of editors that visudo will use set at compile-time that may be overridden via the editor sudoers Default variable. 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 editor in the aforementioned editors list. However, if visudo is configured with the --with-enveditor flag or the enveditor 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.

Last edited by rworkman; 11-13-2008 at 04:30 PM.
 
Old 11-13-2008, 04:28 PM   #5
annihilan
Member
 
Registered: Jul 2008
Posts: 58

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by trickykid View Post
Don't use vi, the proper way is to use visudo command to edit sudoers. It'll prompt if you make mistakes and it also locks the file while it's being edited.

vi is easy though, here are some of the basics:

i = insert mode (edit mode)
esc = command mode

x = delete present character
dd = delete whole line
dw = delete current word
o = start new line for editing from present line
a = start editing one character to the right

wq = write and quit
Shift+ZZ = write to the file and quit
The thing is, I don't know how to actually do the commands, I su to root and then visudo, and then the content appears in my terminal window, I add what I want in, and then I can't figure out how to save it, where do I put in ZZ?
Help......... D:
 
Old 11-13-2008, 04:36 PM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by annihilan View Post
The thing is, I don't know how to actually do the commands, I su to root and then visudo, and then the content appears in my terminal window, I add what I want in, and then I can't figure out how to save it, where do I put in ZZ?
Help......... D:
You can either then press ESC to go back into the command mode and issue :wq! to save and quit and or do a Shift+ZZ in command mode to quit and save.
 
  


Reply

Tags
help, sudo, sudoers, vi


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how a user can be added to sudoers file. afaheem1988 Linux - Newbie 5 08-10-2008 07:15 PM
Adding command privilege to /etc/sudoers doesn't work for some programs CJS Linux - General 9 05-13-2008 11:08 AM
user is not in the sudoers file after clean install Mark_667 Red Hat 3 02-11-2008 11:16 AM
Debian user not in sudoers file... phantom_cyph Linux - General 3 04-08-2007 01:08 PM
I deleted /etc/sudoers and creates a new file call sudoers but now it doesnt for visu abefroman Linux - Software 1 11-10-2005 05:03 PM


All times are GMT -5. The time now is 11:41 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration