Problems with root access!

Asked by sgfhoisgj sdroigdsjfoihjsg

I'm getting a very strange problem when I build and boot an ISO, and I've tried EVERYTHING to get it to work correctly! I'm very desperate now, so PLEASE help me! I'm using Mint 20 Cinnamon 64-bit and trying to make a custom ISO which will run in live mode but WITH a secure login password. But I also need to modify a few things in the home directory (or subdirectories of it) and that's also causing a bit of a glitch.

I've tried basically two approaches:
- Giving a password to the default "root" user
- Making a separate user with a password to log in

When I try the method for the root user, no matter what password I assign (using usermod -p [password] root), for some reason it never requires me to give it when logging in. I also checked this page and followed its instructions for disabling auto-login:

https://techpiezo.com/linux/enable-or-disable-automatic-login-in-ubuntu-20-04/

Or I tried to follow them but I didn't seem to have the same files or the same text in them, so I couldn't do anything about it (as it turns out I need to edit the /etc/lightdm/lightdm.conf file).

The other problem is that for some reason there's no home folder by default (why?), but if I make one and put a mint folder inside (for some reason, the root gets a folder called "mint" rather than "root") then I can put a .config folder in there and copy in the dconf folder that I had backed up from a different Linux installation (it has all of the user interface preferences the way they need to be, and some are crucially important!).

But it seems like when I put the dconf folder there then any ISO I make and boot from that result ends up causing a glitch so that Cinnamon crashes during startup and can't be reloaded, so it reverts to Mate (which isn't the end of the world, though I'd prefer Cinnamon, but I could use the Mate ISO instead if that would prevent the crash error - but why would it happen in the first place?).

In any case, it doesn't require a password login either, so the other method I've tried, which as I mentioned earlier, is to create an extra user (somehow it defaults to making me login with that user, which is good, but I'm just curious - why does it do that?). When I do it that way I do it like this:

adduser xyz # and then I set a password, and I also make the root account password the same, just in case
usermod -G root xyz
usermod -g 0 xyz

So it's in the root group, and then I put my dconf in the appropriate folder within the /home/xyz folder (which is automatically created when I create the user).

I also use visudo to add an extra line so that it looks like:

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

The root line was already there so I made the xyz line to match. I've seen it say (ALL) rather than (ALL:ALL) in some examples, but mine says (ALL:ALL) by default (and so does my installed Mint on my HD, and that works, so it must be right), but I'm not sure why there's a descrepency; does anyone know?

Anyway, when I boot that it does require me to log in and doesn't cause Cinnamon to crash, which is all good, BUT then when I try to do anything that requires root/sudo access (which for some reason even includes things like mounting and ejecting drives - why?), typing the password doesn't work! I also try it without typing a password (I just leave it blank) and that doesn't work either!

I know for a fact that it's possible to make a live mode work with a password at the login and have it still allow root/sudo access, because I've done exactly that when using Linux Live Kit (sorry for mentioning a competitor, but the reason why I stopped using that is because it's not even compatible with UEFI - thankfully Cubic is, if only I could get it to do what I really NEED it to do!).

I've also tried doing the same thing except with the addition of setting the xyz user ID to 0 so that it matches the root, but when I did that it just logged in automatically as the root, without me typing a password (it didn't crash Cinnamon because I had put the dconf in the xyz/.config directory instead of mint/.config, since I thought that one would be loading, which pretty much verifies that the dconf is causing the problem only when being used for the root/mint user).

So without being able to mount drives it doesn't even have access to the hard drive, and it also can't use many administrative programs that require root access! I'm sure you can see how that could be a problem. Could someone please tell me how I'm going about this the wrong way?

Question information

Language:
English Edit question
Status:
Solved
For:
Cubic Edit question
Assignee:
No assignee Edit question
Solved by:
sgfhoisgj sdroigdsjfoihjsg
Solved:
Last query:
Last reply:
Revision history for this message
Cubic PPA (cubic-wizard) said :
#1

"sgfhoisgj sdroigdsjfoihjsg" is an interesting name!

How is that pronounced?

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#2

It's nonsense. I was in a hurry and I needed an account, but I'm very private so I don't give out my real information. Do you know how to solve my problem though? I've been working on this project for over a year now and it's been nothing but horrible headaches and dead-ends, and this one last part of it has already taken a couple of weeks, but when it's solved everything will FINALLY work and I'll be so relieved! (Well, I also have the crive cloning issue, but I have an alternate way of doing that if necessary, which would only be a slight inconvenience). I REALLY hope someone can help me!

Revision history for this message
Cubic PPA (cubic-wizard) said :
#3

OK. thanks for the honest answer.

I'll answer your other question (usb drive space) first, since it is a quicker answer.

Ive answered questions similar to this on this site previously; I'll have to look around to find it...

Revision history for this message
Cubic PPA (cubic-wizard) said :
#4

There are two options to create a user w/ password.

(1)
The first option is to disable auto-login and set a password for the default user.

Take a look at this answer...
https://answers.launchpad.net/cubic/+question/692073

You may have to resolve cryptsetup, as the other person did.

Also, I'm not sure if Linux Mint has the same files as indicated in the above question. You can check that.

(2)
The second option is to create a user in the Preseed files.
I'll see if I can find a reference to that...

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#5

I'll try that method while you look for the other one, but first I just want to remind you that when I copy the dconfs folder into the root .config it causes Cinnamon to crash (I have no idea why), which is why I either need to use a secondary user (which doesn't cause that problem, for some reason), or otherwise if I do use the root then I may possibly need to use Mate rather than Cinnamon, but because I set up the dconfs in Cinnamon, I have to install Mint with Mate on a new partition and set it up to get a new dconfs (because I would assume the settings are different, right?) before I can try this method. I don't mind doing that, but it will take a bit of time before I can get the results and I don't know if I have time to do it tonight, and also, if you don't think it's necessary then I won't bother, but I guess I'd need an alternative plan then.

By the way, I haven't used the Preseed files but I saw them - I wasn't sure what they were (I'm sort of new to Linux) but I can do that if you come up with any specific text for me to enter. Meanwhile, I'll keep looking into the link that you posted. Thanks.

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#6

Sorry, one more thing (I would have posted it in the other comment but I saw it literally the second after I posted) - I don't have /etc/gdm3/custom.conf as mentioned in your link, but I have /etc/lightdm/lightdm.conf (which I think is the equivalent), but I tried the method of editing that file and was unable to from within Cubic. The file appears normal in my Linux installation on the HD, but in Cubic it either was missing most or all text or the file wasn't there (I did this a while ago so I don't remember the result, but I just remember there was a reason why it didn't work at all - but when I try it again in a moment it should refresh my memory of what went wrong and I'll tell you).

Revision history for this message
Cubic PPA (cubic-wizard) said :
#7

(2)
Preseed approach...

Take a look at comment number 3 in this answer, and scroll down to the "# Users" section.:

https://answers.launchpad.net/cubic/+question/681179

Here is a link for more information: https://help.ubuntu.com/lts/installation-guide/s390x/apbs04.html#preseed-account

(You may still have to disable auto-login, as in approach (1), in case the OK keeps logging you into the default user without requiring a password).

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#8

I figured out the way in which the file is wrong: it doesn't exist. I don't have the /etc/gdm3 folder at all, so I'm looking for /etc/lightdm/lightdm.conf (following the instructions of the link I posted in my first post within this topic - should that work right for this?) but the only files in that folder are lightdm.conf.d, lightdm-gtk-greeter.conf.d and users.conf. Actually the lightdm ones are folders, and inside lightdm.conf.d there's 70-linuxmint.conf, which just says:

[SeatDefaults]
user-session=cinnamon

inside of lightdm-gtk-greeter.conf.d there's 99_linuxmint.conf, which contains:

[greeter]
background=/usr/share/backgrounds/linuxmint/default_background.jpg
theme-name=Mint-X
icon-theme-name=Mint-X
font-name=Ubuntu 11
xft-antialias=true
xft-dpi=96
xft-hintstyle=hintslight
xft-rgba=rgb
indicators=~host;~spacer;~clock;~spacer;~session;~a11y;~language;~power
keyboard=onboard
reader=orca
position = 50%,center 50%,center
default-user-image = #avatar-default
screensaver-timeout = 60
a11y-states=contrast;font;keyboard;reader
user-background = false
clock-format = %a %d %b, %H:%M

That's probably not relevant, but since I was right there I thought I should get the text just in case. Anyway, that's all the information I have about that specific thing, so I hope it's helpful.

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#9

Now I've looked at the page for your second suggested method, and maybe I'm missing something, but I don't see what it has to do with logins, user accounts and passwords, because it seems to be all about a lot of parameters regarding installation, but I'm going to be using live mode only (actually, I'm uninstalling Ubiquity because I don't want it to be possible to install the OS).

If I'm overlooking or misinterpreting something then please clarify. But in any case, I've now created the ISO using the first method, and I followed the instructions precisely, except for the part about disabling the automatic login, only because I have no way of editing a file that I don't have (or even an equivalent file, for that matter, which is strange, considering the fact that I have the file on my Mint which is installed on my HD, but it wouldn't be the first time when there was a discrepency between live mode and installed mode).

It worries me that skipping this step may cause it not to work, but I didn't have a choice, until I can find a file that I can modify to have that effect. It just occurred to me right this second that I could copy the file into Cubic and see if that works, but I already created the ISO without it, so I'll test it now anyway.

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#10

Well I just tested the method in your first link and then I realized a big problem which should have seemed obvious but didn't until afterwards:

That method says to create a new user and log in as that user rather than the default one, but it also says to disable automatic logins.

However, in my case, automatic logins have only ever happened for the default "root" user, but not for users that I create. I have the opposite problem with those users - I can login with a password, but then it requires a password for everything, but it never works, possibly for lack of root/sudo access privilages, but I haven't been able to get that to work either (as I explained in the first post in case you need it for reference).

But I thought of another idea: even though I don't have the files that I need for disabling automatic login, I might be able to just make those files the way they should be and then copy then into Cubic, so that when Linux finds them there hopefully they should work like they normally do when they're there anyway! But then I'll try this with the default account, instead of making a new user, so that way I can still have root access while also having a secure login. I'll try all 3 different possible files just to cover the possibilities.

Then there's still the issue of it causing Cinnamon to crash, but I might be able to fix that if I switch to Mate, but I'll try that next time.

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#11

I'm going to call it a day and come back tomorrow when I have more time, but first I'll explain what happened in the newest test:

I did what I said in the post just above this and tried copying in the three files to disable the automatic login, using the "root"/"mint" account instead of a new user.

Then when I booted it automatically logged in anyway! Granted, this time I didn't do that extra stuff for modifying the kernel (I'll try that again tomorrow, but I didn't have time because the command takes a very LONG time for some reason).

But here's the /etc/lightdm.conf file that I gave it:

[Seat:*]
#autologin-guest=false
#autologin-user=root
#autologin-user-timeout=0

And after I booted and checked the file, it had added extra lines!:

[Seat:*]
#autologin-guest=false
#autologin-user=root
#autologin-user-timeout=0
[SeatDefaults]
allow-guest=false
autologin-guest=false
autologin-user=mint
autologin-user-timeout=0

So I need to prevent that from happening somehow. I think maybe I'll just make the file like so:

[SeatDefaults]
allow-guest=false
autologin-guest=false
autologin-user=aaa # I don't know a way to set it to nothing or override it in any other way, so I'm hoping an invalid user will just cancel it
autologin-user-timeout=0

Anyway, I hope this is a sound idea. Cinnamon still crashed and reverted to Mate. Maybe I'll just try it with Mate.

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#12

Oh, and I just got what you meant by "# Users section". Somehow I ddin't notice that the first time I looked at that page, but I'll check that out tomorrow also.

Revision history for this message
Cubic PPA (cubic-wizard) said :
#13

With the approach described in question https://answers.launchpad.net/cubic/+question/692073, I had the same thing happen.
It ~kept~ automatically logging in.

As I recall, the trick was to `update-initramfs -u`.
(Also, don't forge to install the linux kernel files first!).

Did you remember to do that?

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#14

I didn't install the kernels that time because the first time I did it, it took a very long time and I didn't have enough time for it today, but I'll try it tomorrow.

But the previous time I had tried it I did install them, and I did the update-initramfs-u, and I even did apt-get remove cryptsetup just before it (what's cryptsetup, anyway - for cryptography?). But that hadn't worked, though I don't see how it would have, because I was trying to disable autologin for a user that didn't have autologin in the first place, so I don't know what good that would have done (I hadn't thought it through).

The other option that would be really nice would be to just add root/sudo privileges to an arbitrary user that I would add, but I haven't gotten that to be able to work, or at least whenver I type the password it always says it's invalid even though I'm certain that it's correct (I used a very simple password just to test).

Revision history for this message
Cubic PPA (cubic-wizard) said :
#15

You **have** to do `update-initramfs-u` after you make your changes.
(You only need to install the linux kernel files if they are missing or broken sym-links in /boot).

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#16

I see that *might* be available in the preseeds, but I'll have to look into that more too (I haven't tried any preseeds so I have no idea how well that will turn out). But I need to go for the day, and hopefully I can get it all working finally tomorrow!

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#17

Oh, update-initramfs-u is what soldifies the changes? I'll keep that in mind.

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#18

I just did it again, and it sort of half fixed the problem, but not really. This time the login screen displayed (so autologin must have been disabled) but the password didn't work, and instead it wanted a user name. If I entered any random thing then it wanted a password after that, but if I typed "mint" as the user name then it logged in automatically without a password! So that's still no good. Cinnamon still crashed and reverted to Mate, but this time there were no icons on the desktop and when I right-clicked on it nothing happened. Here's how I configured it:

usermod -p abc root

mkdir /home/mint
mkdir /home/mint/.config

Then I copied the dconf directory that I had backed up into this .config directory.

rm /usr/share/initramfs-tools//scripts/casper-bottom/15autologin
rm /usr/share/initramfs-tools//scripts/casper-bottom/25adduser

I created the /etc/lightdm/lightdm.conf file as shown here:

[SeatDefaults]
allow-guest=false
autologin-guest=false
autologin-user=
autologin-user-timeout=0
greeter-show-manual-login=true

Then I modified the /etc/lightdm/lightdm.conf.d/70-linuxming.conf file and put the same text into it, except that it already had a line after the [SeatDefaults] which said:

user-session=cinnamon

So I just left that there and pasted everything else after it.

I tried service lightdm restart and I think that's when it gave me a list of files that it was updating relative to lightdm, including /etc/lightdm/lightdm.conf, even though it was a new one that I added, so I took that as a good sign. It did say something about changing [SeatDefaults] to [Seat:*], but I didn't know if I should go back into the two files that I changed before and alter them again, so I didn't, but I can try it the next time if it's a good idea.

update-init-ramfs -u

By the way, there also seems to be a live-update-initramfs, but I don't know whether that would work better or not, so I didn't use it.

I didn't do this line:

apt install --reinstall linux-headers-5.4.0-26 linux-headers-5.4.0-26-generic linux-image-5.4.0-26-generic

Because above you said I only need that if it's broken or missing.

So then I went to the next step and used the regular kernel (the only one listed, actually), and booted, and that's when I got the results I described at the beginning of this post.

Did I still somehow do something wrong?

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#19

I tried booting into that one again, and this time the icons displayed on the desktop (though clicking on them did nothing), and I could right-click and get a menu. I created a new document and it didn't appear, but when I opened the desktop in a folder it was there, and nothing else was there (but the only things on it were "Computer", "Home", "Trash" and mounted drives, so I think those are all just implied shortcuts anyway). Also, the desktop seems to always show the same background with no slideshow (I had configured the dconf with a slideshow), which isn't a big deal, but it's an observation of an anomaly.

But then I checked various files to see if they were configured properly:

/etc/lightdm/lightdm.conf still says exactly what I had put in it:

[SeatDefaults]
allow-guest=false
autologin-guest=false
autologin-user=
autologin-user-timeout=0
greeter-show-manual-login=true

And /etc/lightdm/lightdm.conf.d/70-linuxmint.conf still says the same thing as that file, except with the extra user-session=cinnamon just after the [SeatDefaults].

I checked /etc/passwd and it seems pretty much the same as default (root is still there at the beginning) but with the addition of a mint user at the bottom which I didn't add, so it must have happened automatically:

root:x:0:0:root:/root:/bin/bash
...
mint:x:999:999:Live session user,,,:/home/mint:/bin/bash

But when I type the user name root, and then give it the password I assigned, it doesn't work, so the only way I can log in is by typing mint, but then it doesn't ask for a password and logs in immediately.

15autologin and 25adduser within /usr/share/initramfs-tools/scripts/casper-bottom folder are both still gone, as they should be. However, there are a couple that begin with 25 (25configure_init and 25disable_cdrom.mount); I don't know whether that's a problem or not.

I did a service lightdm restart and it made me log in again, but then after Cinnamon crashed again, the desktop icons appeared correctly, and I could add files directly to it, but the slideshow still doesn't work (again, it's not a big deal, but I'm just being thorough in case it's a symptom).

Here's the sudo -ll:

Matching Defaults entries for mint on mint:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin,
    pwfeedback

User mint may run the following commands on mint:

Sudoers entry:
    RunAsUsers: ALL
    RunAsGroups: ALL
    Commands:
 ALL

Sudoers entry:
    RunAsUsers: ALL
    Options: !authenticate
    Commands:
 ALL

Sudoers entry:
    RunAsUsers: root
    Options: !authenticate
    Commands:
 /usr/bin/mint-refresh-cache

Sudoers entry:
    RunAsUsers: root
    Options: !authenticate
    Commands:
 /usr/lib/linuxmint/mintUpdate/synaptic-workaround.py

Sudoers entry:
    RunAsUsers: root
    Options: !authenticate
    Commands:
 /usr/lib/linuxmint/mintUpdate/dpkg_lock_check.sh

That's all the information I have. Can you see what's wrong?

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#20

Come to think of it, I'm not sure how the mint account can't exist by default if it exists in live mode! I mean, it should already be in the pre-customized default ISO file.

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#21

I fixed the crashing Cinnamon problem but not the auto-login problem (which is the most important issue). What I did was manually create a mint user before it had the chance to do it automatically. I gave it a user ID of 999 (which is the same number that it assigns to it), and gave it a password. Now when I boot that it logs in automatically as that user but it also allows sudo access. However, this time I didn't try to disable the auto-login, because I didn't anticipate it being relevant, since I wasn't logging in as root (though I'm beginning to suspect that I never actually was).

Then I tried it again, doing the same thing but also disabling the auto-login stuff like before. That didn't seem to improve the result at all. It caused it to show the login screen, but I still didn't need to type a password.

Revision history for this message
sgfhoisgj sdroigdsjfoihjsg (bodfjoix35cd46gbd7sohdg) said :
#22

I actually fixed it and you wouldn't believe how easy it turned out to be! All I had to do was create a new user and assign it into its own group (the one with the same name as the user, which is created with it by default), and also the sudo group! I didn't make sudo the primary group though, but it still works great!!!