LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-14-2020, 07:06 AM   #1
Oldy
Member
 
Registered: Jul 2020
Posts: 40

Rep: Reputation: Disabled
sudo password for users, not root


I want change the root, but I still have the users (oldie). Example:

Code:
oldie@ubuntu:~$ sudo find / -name 'sudoers'
[sudo] password for oldie:
or

Code:
oldie@ubuntu:~$ sudo apt update
[sudo] password for oldie:
Can I change back to the root again, i.e. [sudo] password for root?

I have su. I had root and oldie before, but now it was broken. I don't know whats before, but I am relative newbie.
Code:
oldie is not in the sudoers file. This incident will be reported.
so I modified oldie ALL=(ALL) ALL in /etc/sudoers

I can not remove and add again users:
Code:
sudo killall -u oldie
sudo deluser --remove-home -f oldie
sudo adduser oldie
Ubuntu 20

Can you help me?

Last edited by Oldy; 07-14-2020 at 07:11 AM.
 
Old 07-14-2020, 07:17 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
The root user is locked by default on Ubuntu. How did it work previously? Had you enabled it with sudo passwd root?

Last edited by shruggy; 07-14-2020 at 07:19 AM.
 
Old 07-14-2020, 07:45 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
use su instead of sudo
or do you mean this: https://superuser.com/questions/1615...-root-password ?
 
Old 07-14-2020, 08:42 AM   #4
Oldy
Member
 
Registered: Jul 2020
Posts: 40

Original Poster
Rep: Reputation: Disabled
Almost there:

root: visudo /etc/sudoers
Code:
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Defaults	rootpw
#Defaults   targetpw

root	ALL=(ALL:ALL) ALL
%admin ALL=(ALL) ALL
%sudo	ALL=(ALL:ALL) ALL
oldy ALL=(ALL) ALL
root: login (user/password)
oldy: exit (no user/pass)
root:

Can you tell me why there are no user and no password anymore on the command exit?
 
Old 07-14-2020, 09:29 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
do you mean when you exit a shell? Exiting a shell means you will stop the current process (shell) and return to the parent process. You need to use sudo to start a new shell/process with extra privileges, but you can always terminate it and return back where you were before.
 
Old 07-14-2020, 12:18 PM   #6
Oldy
Member
 
Registered: Jul 2020
Posts: 40

Original Poster
Rep: Reputation: Disabled
sudo reboot

Thanks alot.
 
Old 07-14-2020, 12:45 PM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
I do not really understand your question.
 
Old 07-14-2020, 01:10 PM   #8
Oldy
Member
 
Registered: Jul 2020
Posts: 40

Original Poster
Rep: Reputation: Disabled
I reboot it, of course user/pass.

Code:
ubuntu@login: oldy
password: _
Code:
oldy $: exit
, and starts again with user/pass.

Code:
oldy $: sudo apt update
[sudo] password for root: _
If you know what I mean But nevermind.

Last edited by Oldy; 07-14-2020 at 01:14 PM.
 
Old 07-14-2020, 01:16 PM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
if I remember well sudo evaluates that sudoers file line by line. In your file Defaults rootpw comes first, so this line will be taken into account.
You do not need to reboot, the sudoers file will be effective immediately when you exit visudo.
 
  


Reply

Tags
su



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] sudo to user other than root but do not allow sudo to root Westmoreland Linux - Security 4 07-13-2022 01:09 PM
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
'sudo ls /root/monitor/' outputs, 'sudo ls /root/monitor/*' does not stf92 Slackware 10 07-19-2012 05:20 PM
[SOLVED] sudo password different from non-sudo password edrom Linux - Newbie 2 04-20-2012 03:00 PM
my sudo password is not the root password newbiesforever Linux - General 7 01-02-2010 09:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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