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


  Search this Thread
Old 06-10-2019, 02:49 AM   #16
LQ Newbie
Registered: Apr 2015
Posts: 3

Rep: Reputation: Disabled

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

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
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 567

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
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):
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):
chmod 0440 /etc/sudoers
Old 06-14-2019, 02:44 PM   #18
Senior Member
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,274

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

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, \
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, \

root ALL =  (ALL) ALL

                      HALT, PRINT, CONSOLE, \

                      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
Registered: Oct 2007
Distribution: Slackware
Posts: 985

Rep: Reputation: 237Reputation: 237Reputation: 237
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
Senior Member
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,274

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

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/local/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

without preceding them with “sudo” command.
2 members found this post helpful.


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
[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 > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:26 PM.

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