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

Notices

Reply
 
LinkBack Search this Thread
Old 06-26-2012, 06:54 PM   #1
ve1drg
Member
 
Registered: Mar 2006
Posts: 48

Rep: Reputation: 15
Sudo


I am running Slackware 13.37. The latest release.
And I am learning.

I am trying to use the sudo command and it says I am not in the Sudoers file.

How do I fix this? Do I add my username to the group file?
I mean to ADM user or other root type user in that file? And yes I am in that file. But it doesn't seem to matter.
 
Old 06-26-2012, 07:06 PM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,927
Blog Entries: 1

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by ve1drg View Post
I am running Slackware 13.37. The latest release.
And I am learning.

I am trying to use the sudo command and it says I am not in the Sudoers file.

How do I fix this? Do I add my username to the group file?
I mean to ADM user or other root type user in that file? And yes I am in that file. But it doesn't seem to matter.
You would normally edit the sudoers file with the...

Code:
visudo
...command

-C
 
Old 06-27-2012, 07:20 AM   #3
ve1drg
Member
 
Registered: Mar 2006
Posts: 48

Original Poster
Rep: Reputation: 15
Would you or someone please provide me the commands to make once in the sudoer file?
And if this is the vi editor, how to I save what I do, and how do I get out of this editor??
I must learn VI but I keep putting it off.


Quote:
Originally Posted by custangro View Post
You would normally edit the sudoers file with the...

Code:
visudo
...command

-C
 
Old 06-27-2012, 07:39 PM   #4
schmatzler
Member
 
Registered: Jan 2011
Location: Germany
Distribution: Slackware64 -current + Multilib
Posts: 114

Rep: Reputation: 40
Running commands with sudo can be a problem sometimes (example: running slackbuilds with correct file permissions).

Why don't you use "su" to login as the root user and run your command without sudo?
 
Old 06-28-2012, 02:44 AM   #5
alekow
Member
 
Registered: Sep 2009
Distribution: Slackware
Posts: 127

Rep: Reputation: 17
Quote:
Why don't you use "su" to login as the root user and run your command without sudo?
+1
Quote:
And if this is the vi editor, how to I save what I do, and how do I get out of this editor??
You can use the editor you like by typing in command such as:

Code:
EDITOR="mcedit" visudo
or similar.
 
1 members found this post helpful.
Old 06-28-2012, 04:01 AM   #6
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,636

Rep: Reputation: 730Reputation: 730Reputation: 730Reputation: 730Reputation: 730Reputation: 730Reputation: 730
If you are going to use sudo with slack you should add /usr/local/sbin /usr/sbin and /sbin to the path of your regular user as it will make life much easier. Additionally put the command 'complete -cf sudo' somewhere appropriate like your ~/.bashrc if you want command completion. Though before you do all that reconsider the advice from schmatzler and alekow regarding just using su.

The thing about sudo is that it works best when you have multiple admins on the same machine or want to grant access to individual commands to specific users. However for a personal machine it is pretty much pointless IMHO and for that reason I never understood why Ubuntu pushes it so hard given their primary target market.

Anyway, here are my thoughts from a similar thread in the past:

Quote:
Originally Posted by ruario View Post
Consider if I wanted to run the fake command 'example' once as a root user. Here is what I would actually have to type (where $password is my actual password).

Using su:
su[Enter]$password[Enter]example[Enter][Ctrl]+d
(Note: That is '[Ctrl]' and 'd' together to exit the root session, you obviously aren't typing the '+' character)

Using sudo:
sudo[space]example[Enter]$password[Enter]

Ignoring the characters needed that are the same in both cases (i.e. 'example' followed by [Enter] and your password followed by [Enter]), you have to type 5 key presses to execute a single command as root via 'su' (s u [Enter] [Ctrl] d) and 5 key presses to execute a single command as root via 'sudo' (s u d o [space]). Or to put it another way, you save nothing using sudo.

If however you wanted to type two or more commands as root, you immediately start saving on the key presses by using 'su' instead of 'sudo'. Yes the second 'sudo' command does not require a password but as long as you have not closed your root session yet (i.e. no Ctrl+d) you don't have to type your password again with 'su' either and you save having to write 'sudo' for every single line.

There is also the point that outside of distros where 'sudo' is preconfigured (e.g. Ubuntu and derivatives) you save time configuring '/etc/sudoers' and setting up various admin variables for your regular user.

Indeed the other nice thing with using 'su' is that you can just open a root terminal for all your admin needs and you decide if and when you should close it, rather than relying on preconfigured time-out periods with 'sudo'.

Last edited by ruario; 06-28-2012 at 01:54 PM. Reason: Added a note about 'complete -cf sudo'
 
Old 06-30-2012, 05:30 AM   #7
ottavio
Member
 
Registered: Nov 2007
Posts: 312

Rep: Reputation: 46
Quote:
Originally Posted by alekow View Post
+1


You can use the editor you like by typing in command such as:

Code:
EDITOR="mcedit" visudo
or similar.
I believe Slackware's visudo is hard-coded to run vi.

Code:
 man visudo
       There is a hard-coded list of one or more editors that visudo will use set at compile-time that may be
       overridden via the editor sudoers Default variable.  This list defaults to "/usr/bin/vi".  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-env-editor option 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.
 
Old 06-30-2012, 06:14 AM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 14,877
Blog Entries: 2

Rep: Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805
Quote:
Originally Posted by ottavio View Post
I believe Slackware's visudo is hard-coded to run vi.

Code:
 man visudo
       There is a hard-coded list of one or more editors that visudo will use set at compile-time that may be
       overridden via the editor sudoers Default variable.  This list defaults to "/usr/bin/vi".  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-env-editor option 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.
Believe is irrelevant when it comes to technical systems. A short look into the Slackbuild for sudo reveals that it is compiled with the "--with-env-editor" option. So specifying and editor works fine.
 
Old 08-13-2012, 12:44 AM   #9
mrascii
Member
 
Registered: Jun 2012
Location: on the Net
Distribution: Slackware
Posts: 100

Rep: Reputation: Disabled
Quote:
I never understood why Ubuntu pushes it so hard given their primary target market.
Obvious I think. It removes the temptation to work as root all the time and only one password is needed not two.

DNA
AKA mrascii
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The Ultimate Sudo FAQ To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
Can't use sudo, only account that's not root is not a sudo'ers [Ubuntu 9.10] randyriver10 Linux - Desktop 1 01-09-2010 07:56 PM
Problem with SUDO : sudo: pam_authenticate: Module is unknown cristoph_ Linux - Software 2 03-02-2009 07:12 PM
sudo blkid vs. sudo fdisk -l problems alienexplorers Linux - Newbie 1 01-13-2009 12:35 AM
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM


All times are GMT -5. The time now is 09:30 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