LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-03-2022, 10:32 AM   #1
kiyoshi77
LQ Newbie
 
Registered: Jun 2022
Posts: 5

Rep: Reputation: 0
Question fail to get sudo to work


Hi, I am trying to get sudo to work on my machine, but I keep getting the following message when ever I try to use sudo: "userName is not in the sudoers file. This incident will be reported". how ever userName is in the sudoers file. Here are the steps I took to add my user to sudo
  1. groupadd usrName sudo
  2. nano /etc/group check that sudo:x:1000:usrName
  3. nano /etc/sudoers uncomment %sudo ALL=(ALL:ALL) ALL
  4. nano /etc/profile set sys path to "/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/sbin:/sbin"
  5. reboot
  6. test sudo

Is there another step I am missing to enable sudo. As a side note after I enable sudo I'll like to limit how much I can do with sudo but first I need to ge the basics to work. I am used to archlinux and I want to switch to slackware because I am tired of the 'rolling updates' and want something more stable.

Moderator, if you want you can delete this tread. right after posting I looked in my group file and saw this line usrName:x:1000: and I deleted it. now sudo is working

Last edited by kiyoshi77; 06-03-2022 at 10:40 AM.
 
Old 06-03-2022, 10:50 AM   #2
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,302
Blog Entries: 61

Rep: Reputation: Disabled
Just mark it as "Solved" using the Thread Tools drop-down menu.
 
1 members found this post helpful.
Old 06-03-2022, 10:50 AM   #3
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,302
Blog Entries: 61

Rep: Reputation: Disabled
Just mark it as "Solved" using the Thread Tools drop-down menu.
 
1 members found this post helpful.
Old 06-03-2022, 10:56 AM   #4
SpacePlod
Member
 
Registered: Jan 2014
Distribution: Slackware
Posts: 115

Rep: Reputation: Disabled
Quote:
Originally Posted by kiyoshi77 View Post
4. nano /etc/profile set sys path to "/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/sbin:/sbin"
One note on this: rather than editing the system-wide path it's probably better to have your sudo path set within sudo itself. Check out these lines in sudoers:
Code:
## Uncomment to use a hard-coded PATH instead of the user's to find commands
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
 
1 members found this post helpful.
Old 06-03-2022, 10:57 AM   #5
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,797

Rep: Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436
Just use "su" instead. I dislike "sudo" because it has cleared the path for many "modern" distros to not even setup a root account and deny running many apps as root. I love CLI and commonly do not boot directly to X11 but when editing most config files I prefer using a Super User File Manager that will launch a root level editor as I need it and give me a split screen so I can do compares all in one place and visually.
 
Old 06-03-2022, 11:05 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,982

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
Quote:
Originally Posted by kiyoshi77 View Post
  1. groupadd usrName sudo # ok
  2. nano /etc/group check that sudo:x:1000:usrName # ok
  3. nano /etc/sudoers uncomment %sudo ALL=(ALL:ALL) ALL # not a good idea
  4. nano /etc/profile set sys path to "/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/sbin:/sbin" # why do you need this?
  5. reboot
  6. test sudo

Is there another step I am missing to enable sudo. As a side note after I enable sudo I'll like to limit how much I can do with sudo but first I need to ge the basics to work. I am used to archlinux and I want to switch to slackware because I am tired of the 'rolling updates' and want something more stable.
Yes, you need to remove that ALL= line and allow only what is really required. This is just a security hole.
 
1 members found this post helpful.
Old 06-03-2022, 08:14 PM   #7
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,361
Blog Entries: 28

Rep: Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148Reputation: 6148
I agree heartily with enorbet about sudo.

Sudo was created to give limited, specific administrative rights to persons who needed them to fulfill their responsibilities, not to be a substitute for root.
 
Old 06-03-2022, 09:04 PM   #8
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by enorbet View Post
Just use "su" instead. I dislike "sudo" because it has cleared the path for many "modern" distros to not even setup a root account and deny running many apps as root. I love CLI and commonly do not boot directly to X11 but when editing most config files I prefer using a Super User File Manager that will launch a root level editor as I need it and give me a split screen so I can do compares all in one place and visually.
Eh, to each their own. I use sudo on one-off commands requiring root. If I'm doing several tasks as root, I'll su.

Either way I think almost everyone can agree that using sudo or su is better than running everything as root
 
  


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] if [[ -n "$1" ]]; then FAIL FAIL FAIL rbees Programming 7 03-25-2015 02:39 PM
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
sudo fails - "sudo: can't get hostname: Success" fantasygoat Linux - Server 3 10-01-2009 02:59 PM
sudo apt-get update && sudo apt-get upgrade hallve_revera Linux - Newbie 6 01-10-2009 09:37 AM
cannot "sudo apt-get uptate" or "sudo" anything! plz help mdguy21061 Linux - Newbie 7 04-13-2008 11:59 PM

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

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