Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Activating The Root Account (I Want To Use Su Not Sudo)

Ask for help with issues regarding the Installations of the Debian O/S.
Message
Author
Caitlin
Posts: 329
Joined: 2012-05-24 07:32
Has thanked: 3 times
Been thanked: 2 times

Activating The Root Account (I Want To Use Su Not Sudo)

#1 Post by Caitlin »

When installing Stretch I chose NOT to create a root account. Big mistake. It didn't ask me for a root password, and only allows me root access though sudo. Not as convenient.

I tried to put back the root account. Useradd wouldn't let me do it as it said root already exists. I tried using usermod to unlock it, and it said I couldn't do that as that would create a passwordless account. So I added a password, then was able to unlock it.

But when I tried to log on to root, it wouldn't let me -- it said wrong password.

What is the best way to construct a proper root account? (Without reinstalling.) More to the point, how can I get su (not sudo) to work?

Please don't ask me why I want to use su instead of sudo.

Caitlin

User avatar
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#2 Post by acewiza »

Caitlin wrote:But when I tried to log on to root, it wouldn't let me -- it said wrong password.
Why can't you change the root password, like so?

Code: Select all

sudo passwd root
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#3 Post by GarryRicketson »

As acewiza says, you should be able to do it using sudo

There are a few ways to do this.
Try first:

Code: Select all

man passwd
PASSWD(1) General Commands Manual PASSWD(1)

NAME
passwd - modify a user's password

SYNOPSIS
passwd [user]
Using sudo:

Code: Select all

sudo passwd root
and you should get prompted, asking to enter a password,
then a again, to confirm it,
I am not positive on this because I have never used "sudo" so I do not
know if sudo can set "root" s password,..but it should be able to.
Note: root is the "user", so that is why :

Code: Select all

passwd root
'man passwd' gives more details.

If that does not work, this other works, ...


http://www.wikihow.com/Change-the-Root- ... d-in-Linux
Skip down to the part on if you have forgotten or lost the password.

There also are several threads on the forum about this,
http://forums.debian.net/search.php?st= ... oot+passwd

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#4 Post by GarryRicketson »

Please don't ask me why I want to use su instead of sudo.
No need to ask that, and please do not ask me why I have never used "sudo" :mrgreen:

luvr
Posts: 85
Joined: 2016-07-21 19:39
Location: Boom - The Home Town of Tomorrowland, Belgium

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#5 Post by luvr »

Caitlin wrote:It didn't ask me for a root password, and only allows me root access though sudo. Not as convenient.
Why "not so convenient"? (Mind you, I'm not asking why you prefer su over sudo—that is you call entirely. I just wonder if, perhaps, you are unaware of the different ways in which sudo can be used.)

With sudo, you can run a single command, like so:

Code: Select all

sudo COMMANDLINE
Alternatively, you can become root, as follows:

Code: Select all

sudo -s
Last but not least, you can become root and run a login shell, like this:

Code: Select all

sudo -i
The most immediately apparent difference between the “-s” and “-i” options, is the working directory that will be set once you become root: “-s” will not change your working directory, while “-i” will enter the home directory of the root user—i.e., normally ‘/root’. In either case, run the exit command to return to your own user account.
I tried to put back the root account. Useradd wouldn't let me do it as it said root already exists.
Yes, the root user account existed, but it was locked.
What is the best way to construct a proper root account? (Without reinstalling.)
First set a password, then unlock the account—e.g.:

Code: Select all

sudo -s
passwd root
passwd -u root
exit
You should then be able to use the su command to become root:

Code: Select all

su -
Of course, when prompted, you will have to type the root password that you have just set.

User avatar
HuangLao
Posts: 485
Joined: 2015-01-27 01:31
Been thanked: 1 time

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#6 Post by HuangLao »

luvr wrote:
Caitlin wrote:It didn't ask me for a root password, and only allows me root access though sudo. Not as convenient.
Why "not so convenient"? (Mind you, I'm not asking why you prefer su over sudo—that is you call entirely. I just wonder if, perhaps, you are unaware of the different ways in which sudo can be used.)

Of course, when prompted, you will have to type the root password that you have just set.
seriously, why post this when he clearly does not want to use sudo that way and prefers su! :roll:

luvr
Posts: 85
Joined: 2016-07-21 19:39
Location: Boom - The Home Town of Tomorrowland, Belgium

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#7 Post by luvr »

HuangLao wrote:seriously, why post this when he clearly does not want to use sudo that way and prefers su! :roll:
Documentation. Others may have a similar question, but not have such strong preferences. This may help them make an informed decision.
Last edited by luvr on 2017-06-25 19:27, edited 1 time in total.

Caitlin
Posts: 329
Joined: 2012-05-24 07:32
Has thanked: 3 times
Been thanked: 2 times

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#8 Post by Caitlin »

Very strange --

As I said, I gave root a password, then unlocked it, then tried to log on as root -- and it said wrong password. (I'm sure the password I assigned it was the password I tried to log on with.)

Then (according to the advice above) I used sudo passwd root to change root's password (again using the same password as before), but this time when I tried to log on, it worked. Like I said, very strange.

Film at 11.

BTW, the prior post is quoting me as having said "seriously, why post this when he clearly does not want to use sudo that way and prefers su!". I did not say this.

Caitlin

luvr
Posts: 85
Joined: 2016-07-21 19:39
Location: Boom - The Home Town of Tomorrowland, Belgium

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#9 Post by luvr »

Caitlin wrote:BTW, the prior post is quoting me as having said "seriously, why post this when he clearly does not want to use sudo that way and prefers su!". I did not say this.
Sorry—I hadn't noticed the nested quotings, which apparently confused the forum.
I removed the superfluous quotings, and it should be OK now.

luvr
Posts: 85
Joined: 2016-07-21 19:39
Location: Boom - The Home Town of Tomorrowland, Belgium

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#10 Post by luvr »

Caitlin wrote:Very strange
I took a closer look at this issue, and documented my findings in this other thread on this forum.

Caitlin
Posts: 329
Joined: 2012-05-24 07:32
Has thanked: 3 times
Been thanked: 2 times

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#11 Post by Caitlin »

luvr wrote:I removed the superfluous quotings, and it should be OK now.
Thank you. :)
luvr wrote:
Caitlin wrote:Very strange
I took a closer look at this issue, and documented my findings in this other thread on this forum.
I guess I'll never really know why this happened; but if the second password reset "took", I'm happy.

Thanks again.

Caitlin

Caitlin
Posts: 329
Joined: 2012-05-24 07:32
Has thanked: 3 times
Been thanked: 2 times

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#12 Post by Caitlin »

Okay, now I can use su to get root access, and I can't use sudo (which is what I want). Thanks to all who helped.

But when I first used Synaptic, it gave me a choice of (internally) issuing su or sudo. I chose sudo at the time. Now it asks for a password, but won't take the root password, but will accept my user account password.

Is there some way of changing this at this time? Perhaps if I delete a configuration file somewhere, it will ask me to choose again?

I poked around all my "dot" files in home and all the files with synaptic in their name but didn't find anything that would seem to do it.

Caitlin

luvr
Posts: 85
Joined: 2016-07-21 19:39
Location: Boom - The Home Town of Tomorrowland, Belgium

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#13 Post by luvr »

Caitlin wrote:I chose sudo at the time. Now it asks for a password, but won't take the root password, but will accept my user account password.

Is there some way of changing this at this time?
First, run the following command to verify the “libgksu-gconf-defaults” setting:

Code: Select all

$ update-alternatives --display libgksu-gconf-defaults
It will probably tell you that libgksu-gconf-defaults is currently in manual mode, and that it points to “gconf-defaults.libgksu-sudo”:

Code: Select all

libgksu-gconf-defaults - manual mode
  link best version is /usr/share/libgksu/debian/gconf-defaults.libgksu-su
  link currently points to /usr/share/libgksu/debian/gconf-defaults.libgksu-sudo
  link libgksu-gconf-defaults is /usr/share/gconf/defaults/10_libgksu
/usr/share/libgksu/debian/gconf-defaults.libgksu-su - priority 20
/usr/share/libgksu/debian/gconf-defaults.libgksu-sudo - priority 10
Since the “gconf-defaults.libgksu-su priority is the higher one, you can simply switch the setting to auto mode (as root):

Code: Select all

# update-alternatives --auto libgksu-gconf-defaults
Should the priorities have been switched on a new Debian install (which I doubt will be the case, but just to be sure), you will have to manually select the “gconf-defaults.libgksu-su” option:

Code: Select all

# update-alternatives --set libgksu-gconf-defaults /usr/share/libgksu/debian/gconf-defaults.libgksu-su
Alternatively, if you prefer to configure the setting interactively:

Code: Select all

# update-alternatives --config libgksu-gconf-defaults
and, from the list of options displayed, select the one labelled “gconf-defaults.libgksu-su”.

Next (again as root), run the following command:

Code: Select all

# update-gconf-defaults
You will most likely have to log out and log back in again for these changes to take effect.

Caitlin
Posts: 329
Joined: 2012-05-24 07:32
Has thanked: 3 times
Been thanked: 2 times

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#14 Post by Caitlin »

I tried all the above suggestions, one at a time, and tested Synaptic authorization after each one:

# update-alternatives --auto libgksu-gconf-defaults
# update-gconf-defaults
reboot
# update-alternatives --set libgksu-gconf-defaults /usr/share/libgksu/debian/gconf-defaults.libgksu-su
# update-gconf-defaults
reboot
# update-alternatives --config libgksu-gconf-defaults
# update-gconf-defaults
reboot

but no success -- Synaptic refuses to accept the root password, but will accept my user account's password.

For the seventh command above, I was given 3 choices (I chose 0):

Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/share/libgksu/debian/gconf-defaults.libgksu-su 20 auto mode
1 /usr/share/libgksu/debian/gconf-defaults.libgksu-su 20 manual mode
2 /usr/share/libgksu/debian/gconf-defaults.libgksu-sudo 10 manual mode

I am open to suggestion.

Caitlin

luvr
Posts: 85
Joined: 2016-07-21 19:39
Location: Boom - The Home Town of Tomorrowland, Belgium

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#15 Post by luvr »

Caitlin wrote:but no success -- Synaptic refuses to accept the root password, but will accept my user account's password.
It looks to me like Synaptic is no longer using the “su”/“sudo” mechanism, but switched to “PolicyKit” instead.
PolicyKit is based on “actions” with which authorisation rules are associated.

I’m not particularly familiar with PolicyKit, so I will have to dig a little deeper into this issue.
For starters, when you start the Synaptic Package Manager, you should see an authentication window that asks you for a password.
Close to the bottom left of the window, you should see a “Details” entry. If you click on that, you will be shown the PolicyKit action that synaptic requests—it should be “com.ubuntu.pkexec.synaptic”. Since synaptic prompts you for your own password, instead of the “root” one, there must be some PolicyKit configuration file set up to that effect.

Could you run the following command, to see which PolicyKit configuration files set up the “com.ubuntu.pkexec.synaptic” action? Run this as “root”, since some of the directories will not be accessible otherwise:

Code: Select all

grep -r 'ubuntu' /etc/polkit-1 /var/lib/polkit-1 /usr/share/polkit-1
Please post the output from the command.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#16 Post by GarryRicketson »

Yes, but this is Debian, NOT Ubuntu.
But to be honest, I don't know maybe it is another "new feature" added
to Debian as well, ????

luvr
Posts: 85
Joined: 2016-07-21 19:39
Location: Boom - The Home Town of Tomorrowland, Belgium

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#17 Post by luvr »

GarryRicketson wrote:Yes, but this is Debian, NOT Ubuntu.
Even so, the PolicyKit action really is “com.ubuntu.pkexec.synaptic”—so, yes, it must have been copied from Ubuntu.

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#18 Post by Dai_trying »

@Caitlin
Have you tried dpkg-reconfigure synaptic? it might give you the option again to use su instead of sudo although I haven't tested this.

cfb
Posts: 52
Joined: 2017-01-08 16:39
Been thanked: 5 times

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#19 Post by cfb »

As far as I know, the selection between "su" and "sudo" mode for "gksu" can be made either for the system or for the individual user. How to do it for the system has been described earlier in this thread:

Code: Select all

# update-alternatives --config libgksu-gconf-defaults
# update-gconf-defaults
.
To make the selection for the current user, use this command:

Code: Select all

$ gksu-properties
Now, I am quite certain that in Jessie, the user default mode for "gksu" was to use "su" mode. In Stretch I believe this has been changed to use the "sudo" mode. It may be in the documentation somewhere but I have simply noticed it.

luvr
Posts: 85
Joined: 2016-07-21 19:39
Location: Boom - The Home Town of Tomorrowland, Belgium

Re: Activating The Root Account (I Want To Use Su Not Sudo)

#20 Post by luvr »

Dai_trying wrote:@Caitlin
Have you tried dpkg-reconfigure synaptic? it might give you the option again to use su instead of sudo although I haven't tested this.
That was one of the things that I thought of too, but it doesn’t do anything, apparently.

Post Reply