Recover access to a linux (Devuan) distro having lost both username and password

2 views
Skip to first unread message

NummeShkassatUCazzz

unread,
Jun 12, 2022, 10:55:49 AMJun 12
to
(Hi, I'm Soviet_Mario ... the other account does not let me
post, for unknown reasons)


It's been a long time since I last used a Devuan distro on
one laptop.

Yesterday I had to face the fact that I'm unable to remember
either the username or the password or both (more likely the
pwd but unsure).

I can obviously boot from some live DVD (i have MX
wildflower at hand, or else), but I dunno WHAT EXACTLY to
look for and where.

And I even dunno whether or not the informations I need are
stored somewhere "in clear" (= not encrypted).
I tend to think they might be protected from stealing by a
trik as simple as booting from a DVD, or am I wrong ?

Is it there some way to recover the install ?
I don't have "unique" data there, but I have a lot of stuff
installed, and reconfigure from scratch would be really
annoying.

Tnx for hints

Bye
(Soviet_Mario)

J.O. Aho

unread,
Jun 12, 2022, 11:46:07 AMJun 12
to

On 12/06/2022 16.55, NummeShkassatUCazzz wrote:

> It's been a long time since I last used a Devuan distro on one laptop.
>
> Yesterday I had to face the fact that I'm unable to remember either the
> username or the password or both (more likely the pwd but unsure).
>
> Is it there some way to recover the install ?
> I don't have "unique" data there, but I have a lot of stuff installed,
> and reconfigure from scratch would be really annoying.

As long as it's not an encrypted driver and you forgot the decrypt
keyword, then you can always boot into single user mode.

1. At Grub boot selector press 'e' key
2. Go to the row starting with "linux" and type '1' without the single
quotes at the end of that line
3. Press the 'F10' key

After a while you should end up in a primitive dash prompt where you can
run passwd to change password.

Change current user (root in this case):
passwd

Change another user:
passwd other_user_name

If you are unsure about the user name, you can look in /etc/passed,
usually this is the same as the users home directory, so a "ls /home"
can be enough too.


If you prompt want to use the Install DVD media, you boot it up as
normally and then

1. mount the system disk
2. chroot into the directory to where the system disk was mounted
3. run passwd in the same manner as above.


The first method has the drawback that grub may be password protected,
but normally people do not password protect grub, so you don't have to
enter a password when you press 'e'.

The second one may need that you bind mount /dev /sys and /proc to the
mounted directory for the system disk, but that depends on the command
you need to run. The bind mount needs to be unmounted before you can
unmount the system disk.

--
//Aho

Marco Moock

unread,
Jun 12, 2022, 12:55:08 PMJun 12
to
Am Sonntag, 12. Juni 2022, um 16:55:46 Uhr schrieb NummeShkassatUCazzz:

> I can obviously boot from some live DVD (i have MX
> wildflower at hand, or else), but I dunno WHAT EXACTLY to
> look for and where.

You can boot a live distro, then mount the root partition of your
system, e.g. to /mnt.
Then read out /mnt/etc/passwd.
You will see your user names.
In the live distro you can create a new user with a new password, then
check /etc/shadow (not /mnt!) for the hash and replace the old hash in
/mnt/ect/shadow with the new one.

J.O. Aho

unread,
Jun 12, 2022, 3:25:16 PMJun 12
to
If he has mounted the partition, he can also chroot and change the password.

if mounted to /mnt then:
chroot /mnt

and then run "passwd <username>"

--

//Aho

Paul

unread,
Jun 12, 2022, 4:30:07 PMJun 12
to
Using another LiveDVD, edit /etc/passwd on the broken disk.

On commercial systems or systems owned by IT guys,
this isn't going to work.

But on home default installs, it might just work.

After screwing up my Gentoo install yesterday,
I had to go in after the reboot and purge the
miserable password, so I could get in.

In this picture, I used a Mint LiveDVD to mount and
edit the /etc/passwd file on the affected (Devuan) system.

After removing the "x" which points to the shadow file,
and saving back as root, on next Devuan run, the
password box for my user account is gone, because
the password entry is now "blank".

[Picture]

https://i.postimg.cc/Kj2R2vYV/password-fix.gif

Don't forget to define a password, for whatever
accounts(s) you flatten. You could equally well do
this to the root account at the top.

Paul

bad sector

unread,
Jun 13, 2022, 6:49:30 AMJun 13
to
if you can boot it, log-in as root and do John Aho's suggestion: examine /etc/group and /etc/passwd to get out the details for 'useryou', and then just change that pwd.

# passwd useryou

exit and log-in as that user


Soviet_Mario

unread,
Jun 13, 2022, 7:39:08 AMJun 13
to
ok, tnx to all ... I hope Devuan /passwd structure will be
the same as above, apart from username.

Anyway no, the install was not actually "broken", but just
not used for a long time and I simply forget all about it :\

I had used that laptop just at school, but willy nilly I
have been suspended from work for almost a year now :\



--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le tasse le pagano tutti
Soviet_Mario - (aka Gatto_Vizzato)

Soviet_Mario

unread,
Jun 13, 2022, 7:55:44 AMJun 13
to
On 12/06/22 16:55, NummeShkassatUCazzz wrote:

Sorry, but I did not diagnose the problem correctly.
It SEEMED that pws &/or username were wrong ... but they
actually weren't.

I explored the install from the USB live distro, and in the
"scrivania" (desktop ?) of the laptop Devuan install I had
left a plain text file with every pwd necessary, included
username and pwd.
And they had been entered correctly.

So now I am thinking there could be some problem with
LightDM or so, as it refuses to accept the CORRECT login
credentials, and "loops" ...
Dunno how to better diagnose or to workaround :\

Boh !

J.O. Aho

unread,
Jun 13, 2022, 8:49:00 AMJun 13
to

On 13/06/2022 13.55, Soviet_Mario wrote:
> On 12/06/22 16:55, NummeShkassatUCazzz wrote:
>
> Sorry, but I did not diagnose the problem correctly.
> It SEEMED that pws &/or username were wrong ... but they actually weren't.
>
> I explored the install from the USB live distro, and in the "scrivania"
> (desktop ?) of the laptop Devuan install I had left a plain text file
> with every pwd necessary, included username and pwd.
> And they had been entered correctly.
>
> So now I am thinking there could be some problem with LightDM or so, as
> it refuses to accept the CORRECT login credentials, and "loops" ...
> Dunno how to better diagnose or to workaround :\

For LightDM you should have some logs in /var/log/lightdm or directly in
/var/log, those log could have something that give you a hint on what is
going on.

Something that is handled differently by different display managers are
how they react when you don't have read/write access to the home
directory, usually it will just flash and then you are back at the login
again. In those cases at least it can be good to check that /home is
readable by everyone and that the /home/username directory is owned and
writeable by the user.

It's possible that you have a half update, then login to console and do
a system update, should give you dependencies that maybe missing.

--

//Aho

Bit Twister

unread,
Jun 13, 2022, 9:14:13 AMJun 13
to
On Mon, 13 Jun 2022 13:55:42 +0200, Soviet_Mario wrote:
> On 12/06/22 16:55, NummeShkassatUCazzz wrote:
>
> Sorry, but I did not diagnose the problem correctly.
> It SEEMED that pws &/or username were wrong ... but they
> actually weren't.
>
> I explored the install from the USB live distro, and in the
> "scrivania" (desktop ?) of the laptop Devuan install I had
> left a plain text file with every pwd necessary, included
> username and pwd.
> And they had been entered correctly.
>
> So now I am thinking there could be some problem with
> LightDM or so, as it refuses to accept the CORRECT login
> credentials, and "loops" ...

I have seen that problem. It occurred on my system when I introduced
a bug in one of the scripts executed during login.

Now when I change any login script I do a "su - junk" to verify I can
log into my junk test account.


> Dunno how to better diagnose or to workaround :\

Boot system at run level 3 (non-gui run level) and log in at the
console and watch for errors.


Paul

unread,
Jun 13, 2022, 10:29:16 AMJun 13
to
The picture I took, is from a Devuan install.
I verified this would work.

Paul

jak

unread,
Jun 13, 2022, 12:06:02 PMJun 13
to
Hi Mario,
I remember that 30 years ago it was enough to boot the system in SUMM
and delete the data of the second field in the user's line in
/etc/passwd to have a user login without a password.
(altri tempi)
XD

Kirk_Rockstein

unread,
Jun 13, 2022, 2:53:44 PMJun 13
to

On 2022-06-13, Soviet_Mario <Sovie...@CCCP.MIR> wrote:
> On 12/06/22 16:55, NummeShkassatUCazzz wrote:
<snip>
> So now I am thinking there could be some problem with
> LightDM or so, as it refuses to accept the CORRECT login
> credentials, and "loops" ...
> Dunno how to better diagnose or to workaround :\
>

I had this problem years ago ... had nothing to do with the
username or password. Some buggy program I installed had changed permissions
on the /tmp directory, so lightdm could not write its authority file
to /tmp. Have not used Lightdm for over 15 yrs so can not remember the
actuall name of the file. (Use SLIM here)
From a terminal run ls -al against the root of the devaun file system
and make sure the permissions for /tmp are right.
drwxrwxrwt 12 root root 16384 Jun 13 13:05 tmp
Note the "t", if that is not there you have found your problem.

Soviet_Mario

unread,
Jun 13, 2022, 6:27:59 PMJun 13
to
On 13/06/22 12:49, bad sector wrote:
> On 6/12/22 10:55, NummeShkassatUCazzz wrote:
>> (Hi, I'm Soviet_Mario ... the other account does not let me post, for unknown reasons)
>>
>>
>> It's been a long time since I last used a Devuan distro on one laptop.
>>
>> Yesterday I had to face the fact that I'm unable to remember either the username or the password or both (more likely the pwd but unsure).
>>
>> I can obviously boot from some live DVD (i have MX wildflower at hand, or else), but I dunno WHAT EXACTLY to look for and where.
>>
>> And I even dunno whether or not the informations I need are stored somewhere "in clear" (= not encrypted).
>> I tend to think they might be protected from stealing by a trik as simple as booting from a DVD, or am I wrong ?
>>
>> Is it there some way to recover the install ?
>> I don't have "unique" data there, but I have a lot of stuff installed, and reconfigure from scratch would be really annoying.
>>
>> Tnx for hints
>>
>> Bye
>> (Soviet_Mario)
>
> if you can boot it, log-in as root
It boots but
I cannot login in any way, despite entering the CORRECT
username+pwd

> and do John Aho's suggestion: examine /etc/group

I'll look for this ...

> and /etc/passwd

I have replaced the X as I have been told, but It asks for
PWD nonetheless (and does not accept either zero pwd or the
correct pwd).

the root pwd is the same, but which username has the root
user ? Plain "root" ?

I am suspecting sth in the LightDM is corrupted somewhat


> to get out the details for 'useryou', and then just change that pwd.
>
> # passwd useryou
>
> exit and log-in as that user
>
>


Paul

unread,
Jun 13, 2022, 7:42:55 PMJun 13
to
On 6/13/2022 7:59 AM, Soviet_Mario wrote:

> I have replaced the X as I have been told, but It asks for PWD nonetheless (and does not accept either zero pwd or the correct pwd).
>
> the root pwd is the same, but which username has the root user ? Plain "root" ?
>
> I am suspecting sth in the LightDM is corrupted somewhat

You have to be careful to edit the correct file.
And double-check that when you write it, the
write actually was carried out.

root:x:0:0:root:/root:/bin/bash
bullwinkle:x:1000:1000:Bullwinkle,,,:/home/bullwinkle:/bin/bash

Flatten the root password and the user password, as you wish. Save.
Then do "less /media/mint/345s234t4ff46y5rt4/etc/passwd" and verify.

root::0:0:root:/root:/bin/bash
bullwinkle::1000:1000:Bullwinkle,,,:/home/bullwinkle:/bin/bash

When done from some other live media, when the devuan file system
is mounted, the file to edit will have a long name. The string
of characters might be the UUID of the file system or something.

sudo nano -w /media/mint/345s234t4ff46y5rt4/etc/passwd

If you were editing /etc/passwd on the live media, that would
not work. You have to make sure you made the edits to the *correct*
file, before the reboot.

Paul

Jasen Betts

unread,
Jun 15, 2022, 8:00:49 AMJun 15
to
It could also be /etc/shadow it will have a jumble in the second slot
(after the first colon), just delete the jumble and there will be no
password needed. (also delete X in /etc/passwd)

There's man pages for this (man 5 passwd shadow)

--
Jasen.

Soviet_Mario

unread,
Jun 19, 2022, 3:06:52 PMJun 19
to
what is exactly a jumble in that context ?

P.S. I am not responding to most as I am particularly
discouraged about this.
I will never feel comfortable working with terminal

>
> There's man pages for this (man 5 passwd shadow)
>


--

J.O. Aho

unread,
Jun 20, 2022, 1:37:16 AMJun 20
to

On 19/06/2022 21.06, Soviet_Mario wrote:
> On 15/06/22 13:57, Jasen Betts wrote:

>> It could also be /etc/shadow  it will have a jumble in the second slot
>> (after the first colon), just delete the jumble and there will be no
>> password needed. (also delete X in /etc/passwd)
>
> what is exactly a jumble in that context ?

A random mix of characters, digits, and symbols of different ways.

What he want to you to do is the same as running:
passwd -d <username>

The only difference is that you wouldn't have to chroot, but you have
the risk of breaking the passwd and shadow files.

chroot is quite simple to use, where you have your root partition
mounted, say /mnt, then you just run:
chroot /mnt

and when you get the next prompt, you are in the chrooted environment
and then you can remove the password requirement with:
passwd -d mario

and to get out of the chroot, you just press 'ctrl-d' or type 'exit',
followed by an enter.


--

//Aho

bad sector

unread,
Jun 20, 2022, 7:57:33 PMJun 20
to
On 2022-06-13 07:59, Soviet_Mario wrote:
> On 13/06/22 12:49, bad sector wrote:
>> On 6/12/22 10:55, NummeShkassatUCazzz wrote:
>>> (Hi, I'm Soviet_Mario ... the other account does not let me post, for unknown reasons)
>>>
>>>
>>> It's been a long time since I last used a Devuan distro on one laptop.
>>>
>>> Yesterday I had to face the fact that I'm unable to remember either the username or the password or both (more likely the pwd but unsure).
>>>
>>> I can obviously boot from some live DVD (i have MX wildflower at hand, or else), but I dunno WHAT EXACTLY to look for and where.
>>>
>>> And I even dunno whether or not the informations I need are stored somewhere "in clear" (= not encrypted).
>>> I tend to think they might be protected from stealing by a trik as simple as booting from a DVD, or am I wrong ?
>>>
>>> Is it there some way to recover the install ?
>>> I don't have "unique" data there, but I have a lot of stuff installed, and reconfigure from scratch would be really annoying.
>>>
>>> Tnx for hints
>>>
>>> Bye
>>> (Soviet_Mario)
>>
>> if you can boot it, log-in as root
> It boots but
> I cannot login in any way, despite entering the CORRECT username+pwd
>
>> and do John Aho's suggestion: examine /etc/group
>
> I'll look for this ...
>
>> and /etc/passwd
>
> I have replaced the X as I have been told, but It asks for PWD nonetheless (and does not accept either zero pwd or the correct pwd).
>
> the root pwd is the same, but which username has the root user ? Plain "root" ?
>
> I am suspecting sth in the LightDM is corrupted somewhat

are you able to log-in as root or are you doing this from another system with root privs or with chroot?




Reply all
Reply to author
Forward
0 new messages