SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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):
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309
Rep:
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.
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...
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309
Rep:
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.