LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 06-10-2019, 02:49 AM   #16
automaticjerk
LQ Newbie
 
Registered: Apr 2015
Distribution: Slackware
Posts: 17

Rep: Reputation: Disabled

Quote:
Originally Posted by Captain Brillo View Post
Can somebody explain why "visudo" seems to be read-only?
I know this has been marked solved, but there is one more thing you should probably do before walking away from visudo:

Run vimtutor. Vi is available in one form or another in practically every *nix system. Most other editors are not. There's nothing wrong with preferring nano or emacs or what-have-you, but knowing how to use vi is an incredibly helpful skill. Sure, it's quite possibly the most user-hostile text editor in common use today. But as soon as you get the basics figured out, you'll be flying through config files like you wouldn't believe. And, as hazel has said, it is highly recommended that you use visudo to edit your sudoers file. Aside from that, it's one of the most powerful tools you can have in your arsenal. Plus, you get bragging rights when you show it off to your windows using friends that still use notepad like every other backwards mud-eating savage.

Just do

Code:
vimtutor
in a terminal, play with it for about 20 - 30 minutes, and be prepared to own your computer.
 
Old 06-10-2019, 03:35 AM   #17
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 917

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Quote:
Originally Posted by Captain Brillo View Post
Thanks, all.
Finally managed to get at the "sudoers" file, and modified it like chris.willing suggested.
Now I'm ok.
Good that you made it work. However, although I mentioned the possibility of directly modifying the sudoers file, I wasn't really advocating it - others have already cautioned against it.

Note that the correct the permission for /etc/sudoers is read only for the root user & group. No one else should have any access to it. I guess this also encourages using the visudo utility to modify it. As for visudo itself being read only, this doesn't make sense. If you had trouble modifying anything while using it, it was probably because you're not familiar with how the default editor, vi (or vim), works. In that case, you can make visudo use a different editor such as nano by running (as root):
Code:
VISUAL=nano visudo
Give that a try, even if you have already edited the sudoers file the way you want it, just so that we others can know if that was the cause of your "readonly visudo" problem.

Also, presuming you have changed the permissions to enable editing it directly, don't forget to restore the correct permissions for it. Run (as root):
Code:
chmod 0440 /etc/sudoers
 
Old 06-14-2019, 02:44 PM   #18
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
This is my /etc/sudoers file:

Code:
Defaults    timestamp_timeout = 0

User_Alias  FULL    = john
User_Alias  PART    = mary

Cmnd_Alias  CDWR    = /usr/bin/mkisofs, /usr/bin/cdrecord, \
                      /usr/bin/cdda2wav, /usr/bin/cdrdao, \
                      /usr/bin/dvd+rw-format
Cmnd_Alias  MOUNT   = /bin/mount, /bin/umount
Cmnd_Alias  KILL    = /bin/kill, /bin/killall

Cmnd_Alias  HALT    = /sbin/reboot, /sbin/halt, /usr/bin/suspend
Cmnd_Alias  PRINT   = /usr/bin/lpr, /usr/bin/lpq, /usr/bin/lprm
Cmnd_Alias  CONSOLE = /usr/bin/setfont, /usr/bin/loadkeys

Cmnd_Alias  NET     = /usr/local/bin/network, /usr/local/bin/offline, \
                      /usr/local/bin/varlog

root ALL =  (ALL) ALL

FULL ALL =  NOPASSWD: CDWR, MOUNT, KILL, \
                      HALT, PRINT, CONSOLE, \
                      NET

PART ALL =  NOPASSWD: CDWR, MOUNT, KILL, \
                      HALT, PRINT, CONSOLE, \
            PASSWD:   NET
I believe the above file is self-explanatory. There are two users (john and mary) and two access policies (FULL and PART). Some programs such as /usr/local/bin/network, /usr/local/bin/offline, and /usr/local/bin/varlog are absent in your system.
 
3 members found this post helpful.
Old 06-16-2019, 10:51 PM   #19
andrew.46
Senior Member
 
Registered: Oct 2007
Distribution: Slackware
Posts: 1,365

Rep: Reputation: 493Reputation: 493Reputation: 493Reputation: 493Reputation: 493
Quote:
Originally Posted by Captain Brillo View Post
Alien Bob: I hear you - but having a bit of trouble with NOT thinking Ubuntu/Mint etc. Thanks for your comment.
I originally came from Ubuntu myself so I know where you are coming from . Just to add a slightly differing view: I have never set sudo up on any of my Slackware installations and when I need elevated privileges I use either 'su' or 'su -' from a Terminal where I am user. Just another way of doing things and I am certainly not arguing with those who have given you sound advice concerning sudo. Ubuntu I know has strong feelings on the subject...
 
Old 06-17-2019, 05:42 AM   #20
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
This is part of my ~/.bashrc file:

Code:
export PS1="\u@\h:\w\$ "

alias ls='ls --color=auto -b -T 0'

alias c='perl -e '\''$_="@ARGV";s/\^/**/g;y/x/*/;print eval $_, "\n"'\'''

alias mount="sudo /bin/mount"
alias umount="sudo /bin/umount"

alias kill="sudo /bin/kill"
alias killall="sudo /bin/killall"

alias reboot="sudo /sbin/reboot"
alias halt="sudo /sbin/halt"
alias suspend="sudo /usr/bin/suspend"
It works with /etc/sudoers file from post #18.

So both john and mary may use commands such as:

mount /mnt/sdb1
kill -9 21040
reboot
etc.

without preceding them with “sudo” command.

Last edited by w1k0; 06-24-2019 at 10:59 AM. Reason: wrong path
 
2 members found this post helpful.
  


Reply



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
[SOLVED] How to add a user to a group with a command without removing from another group? erik2282 Linux - Newbie 2 07-12-2017 09:49 AM
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
Block bitmap for group 416 not in group (block 0) + group descriptors corrupted? quanta Linux - Server 1 12-08-2010 10:40 AM
group: add complete group into other group max_mad SUSE / openSUSE 1 04-12-2006 01:43 AM
Group Admin, Group Root, or God over Group crickett Linux - General 5 07-12-2004 04:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:47 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration