LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 01-13-2017, 07:44 AM   #1
Crb999
Member
 
Registered: Jan 2017
Location: West Coast Scotland
Distribution: Suse Linux 42.2 Now 15.1
Posts: 319

Rep: Reputation: Disabled
sudo does not ask for my password


I have used visudo to add myself to the sodoers list

Code:
root ALL=(ALL) ALL
crb999 ALL=(ALL) ALL
It does odd unexpected things!

If I type

Code:
crb999@linux-dxa1:~> NetworkManager

I get

Code:
Absolute path to 'NetworkManager' is '/usr/sbin/NetworkManager', so running it may require superuser privileges (eg. root)
if I use

Code:
crb999@linux-dxa1:~> sudo NetworkManager
I get

Code:
NetworkManager is already running (pid 5692)
But if I try to sudo 'reboot' I get this

Code:
crb999@linux-dxa1:~> sudo reboot
root's password:
I am never asked for my own password but, despite the use of sudo I am asked root's password to reboot.

What am I missing?
 
Old 01-13-2017, 08:33 AM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
when giving yourself root permissions it would be best to follow the others that laid it out in how to do it. By assinging your username to one of the groups that are assigned to get root privileges not by user name specify.

it is because you are not attached to sudo within your sudoers file and perhaps the group itself as well is why it is doing what it is doing.

you used your user name yes?

look and see the bold text to get an idea of what you should be doing.

Quote:
userx@voider~:>> sudo cat /etc/sudoers
## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users. These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands. Often used to group related commands together.
# Cmnd_Alias PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
# /usr/bin/pkill, /usr/bin/top
# Cmnd_Alias REBOOT = /sbin/halt, /sbin/reboot, /sbin/poweroff

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file. Note that other programs use HOME to find
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods. Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## 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"

##
## Uncomment to send mail if the user does not enter the correct password.
# Defaults mail_badpass
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot. Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!REBOOT !log_output

##
## Runas alias specification
##

##
## User privilege specification
##
root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL


[OR]

## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL

[OR]

## Uncomment to allow members of group sudo to execute any command
# %sudo ALL=(ALL) ALL


## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw # Ask for the password of the target user
# ALL ALL=(ALL) ALL # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d
anon ALL=(ALL) NOPASSWD: ALL
now add your user to the group selected to give root permissions.
Code:
su
password
#usermod -aG wheel userName
or
#usermod -aG sudo userName
log out then back in again. Done!

Last edited by BW-userx; 01-13-2017 at 09:02 AM.
 
Old 01-14-2017, 07:07 AM   #3
Crb999
Member
 
Registered: Jan 2017
Location: West Coast Scotland
Distribution: Suse Linux 42.2 Now 15.1
Posts: 319

Original Poster
Rep: Reputation: Disabled
Hi BW-userx, thanks.

I have removed my user name as you suggest and added groups then add my user to those groups.

But the key was commenting out the Defaults targetpw

All ok now

Thaks
 
Old 01-14-2017, 07:22 AM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
if everything is copacetic with this issue then please mark your post as solved by clicking that link on top to make it indicate solved and if this helped you please click yes on the question "Did you find this post helpful? "
 
1 members found this post helpful.
  


Reply

Tags
reboot, sudo



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
No password for sudo? orange400 Linux - Software 9 03-18-2012 10:08 AM
sudo password not same as root password - ubuntu 11.04. hence can't access partitions daudiam Linux - Newbie 1 09-03-2011 11:02 AM
sudo password tweetle_dee Linux - Newbie 6 04-30-2011 05:15 PM
my sudo password is not the root password newbiesforever Linux - General 7 01-02-2010 09:59 PM
Sudo password kapilbajpai88 Linux - Newbie 9 11-06-2009 03:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

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