Pi 4 Bullseye Desktop x64

Hello All!

I have installed this distro via raspberry website and have been installing extra s/w as sources and have got to the point where one of them needs to be installed as root (su). This is not sudo or sudo su etc as that will not work.

So doing su asks for a password and the one used for user pi does not work.

What is it or failing that how say having issued sudo -s can I change it?

Now I did think of using usermod -p password root

but the docs specify :

-p, --password PASSWORD The encrypted password, as returned by crypt(3).

Note: This option is not recommended because the password (or encrypted password) will be visible by users listing the processes.

You should make sure the password respects the system's password policy.

So I am guessing I need to try and install crypt assuming it is available via the distro file repos but the only one I can see is as shown on doing a man crypt which is a library routine and not a program so how on earth do you do it ?

Bye the bye I decided to change the system name via the GUI app that you can change the pi password and on reboot it stops during the boot sequence and will not go any further so I guess Debian is not a happy camper doing a change :(

I must admit I do not recall trying to do the same with any other distro but find it hard to understand why it should not like it, or am I having another senior moment ?

Vincent

Reply to
Vincent Coen
Loading thread data ...

Re: Pi 4 Bullseye Desktop x64 By: Vincent Coen to All on Thu Mar 03 2022 01:04 am

VC> What is it or failing that how say having issued sudo -s VC> can I change it?

VC> Now I did think of using usermod -p password root

$ sudo passwd root

Job done.

Curious to know why 'sudo su' is not working though. If it isn't setting your environment correctly, there is always:

$ sudo su -

Tristan.

Reply to
Tristan Greaves

Hello Tristan!

Thursday March 03 2022 06:57, you wrote to me:

VC>> What is it or failing that how say having issued sudo -s VC>> can I change it?

VC>> Now I did think of using usermod -p password root

Within the Makefile there is :

@if [ "`id -un`" != "root" ] ; then \ echo; echo " Must be root to install!"; echo; exit 3; fi

So if not using su this test will fail.

Although trying echo `id -un` returns root for su, sudo -s So do not understand why it fails the test.

Never less still need to fix the password issue with su Clearly something to do with Debian at least as far as Raspberry version is concerned but think I have had similar issue with another distro using Debian.

Vincent

Reply to
Vincent Coen

Hello nev!

Thursday March 03 2022 10:39, you wrote to me:

Is that with no options to passwd other than passing 'root' ?

Thanks for the method though I will try it after re-installing the O/S as it is failing to boot.

I did set up Trim as suggested by another posters reference to a blog and that appeared to work even after I rebooted so may have something to do with changing the system name but cannot understand why it should be the case.

Vincent

Reply to
Vincent Coen

Hello Ahem!

Thursday March 03 2022 10:39, you wrote to The Natural Philos >> I always set the root password. There are times when it saves >> multiple uses of sudo

To install specific software after compiling using 'make install' must be made using su and sudo -s does not work.

Vincent

Reply to
Vincent Coen

Hello Ahem!

Thursday March 03 2022 14:19, you wrote to me:

That's the problem - I can't log in as root using su or su - as I do not know the password.

Vincent

Reply to
Vincent Coen

I think that until you set a root password, you cannot operate a root shell *at all*

I always set the root password. There are times when it saves multiple uses of sudo

Reply to
The Natural Philosopher

to set a root password I tend to use: sudo bash passwd root

Reply to
nev young

On a personal/home system with one admin, set a root password and use root when needed (don't run browsers etc. as root).

On a business system with multiple admins do not permit root access, have a controlled list of sudoers with an audited sudoers configuration and log everything that happens under sudo against the real user.

Reply to
Ahem A Rivet's Shot

Hello Ahem!

Thursday March 03 2022 14:19, you wrote to me:

The trick was to use passwd root

and change it BUT what the devil was it originally - no docs on this needless to say :(

Vincent

Reply to
Vincent Coen

Hello Vincent!

03 Mar 22 17:03, you wrote to Ahem A Rivet's Shot:

VC> That's the problem - I can't log in as root using su or su - as I do not VC> know the password.

Where is your problem?. It is only a rasberry system, zo it is stored on a USB drive or a Micro SSD. Take ik to the system where you put this image on de datacarrier. Mount the secon partition (rootfs) and look for the shadow file. In the line for root remove the gibberish between the first and second colon, with any editor.

Root will now have no password, so you should set one as soon as you have logged in.

But to be serious, it should not be possible to login on root with a password. There should be a '*' in the shadow files and access should be given in the sudo config.

So instead of my first suggestion to edit the shadow file, edit sudoers, maybe adding your login account to the group sudo is sufficient. That file can also be edited while the rootfs in mounted on the host system.

Kees

Reply to
Kees van Eeten

Home system log in as root and run make install - commercial system don't do that use package management all the way probably backed by a CMS like ansible or puppet.

Reply to
Ahem A Rivet's Shot

sudo won't work until until you've configured it. To do that, log in as root and run 'visudo', which edits /etc/sudoers - beware that this will want to use vi as its editor unless you've set the EDIT global variable, to the name of your preferred editor. I normally set that by editing /etc/ profile.d/less.sh, which takes effect next time you log in.

However ymmv.

Reply to
Martin Gregorie

On a Raspbian fresh install, I have always found: sudo -i [yourpassword] works.

Then 'visudo' to fix any problems, and passwd to set root password.

I.e. sudo uses your password, su uses root password

Reply to
Chris Elvidge

It wasn't set at all originally so root could not log in.

Reply to
Ahem A Rivet's Shot

Yes. sudo bash starts a new bash shell as root. Then passwd root will let you set a new root passwd. As you're now root it doesn't ask for the old/existing one.

Reply to
nev young

Den 2022-03-02 kl. 14:04, skrev Vincent Coen:

I never enable root user on macos or debian-derivatives If I need a root prompt, I

sudo su -

and gives the pi user's passwd.

the prompt is from sudo - and it is run by use r pi (or whoever is logged in)

The only system I tried that do not allow this is centos/rocky (and probably RHEL as well then) - in which the installation guide requires a root pwd to be set and AIX.

Reply to
Björn Lundin

Den 2022-03-04 kl. 10:58, skrev Björn Lundin:

I forgot to mention that the sudoers file is setup to allow this for the first created user on these systems

Reply to
Björn Lundin

Yes. business use you need root and a password, but it should be one person alone that knows it

Reply to
The Natural Philosopher

If you can su you can exhange/set the root password

sudo passwd root

Reply to
The Natural Philosopher

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.