You are not logged in.

#1 2015-11-10 06:09:28

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,299
Website

Strange behaviour if adding user with useradd

This came up here: https://forums.bunsenlabs.org/viewtopic.php?id=581

I was able to reproduce the same behaviour on a Virtual Machine, ie

sudo useradd mari
sudo passwd mari
sudo usermod -a -G sudo,audio,dip,video,plugdev,netdev mari

then login to mari via the usual lightdm interface.
Result: no BL configuration. Of course adduser is the recommended way to add a new user, but the strange thing about this is that while mari's home directory had none of the usual config files, it did contain ~/.config/bunsen/bl-setup

If that file was present on login it would have prevented config files being copied from /usr/share/bunsen/skel by /usr/lib/bunsen/bunsen-configs/bl-user-setup.
So, where did it come from? How could .config/bunsen have been the only thing to be copied in?

Alternatively, could bl-user-setup have been run by lightdm but failed to perform any of its tasks except creating ~/.config/bunsen/bl-setup? Any suggestions? Is this a BL bug? Why should using useradd have this effect?

UPDATE: use 'useradd -m' which creates a user home directory and everything works fine.

So what does lightdm do if trying to login a user without a home directory? That seems to be the crux. It's probably not our fault anyway...

Here's bl-user-setup which is run by lightdm on every login:

#!/bin/bash
# BunsenLabs User Set-up

# USER="$1" USER is exported by lightdm

[ -f "/home/$USER/.config/bunsen/bl-setup" ] && exit 0

cd /usr/share/bunsen/skel
tar cpzf skel.tar.gz .
mv skel.tar.gz /home/$USER/skel.tar.gz
cd /home/$USER
tar --suffix="~$( date +%FT%T )~" -xpsf skel.tar.gz
rm skel.tar.gz

for i in "/home/$USER/.gtk-bookmarks" "/home/$USER/.config/nitrogen/nitrogen.cfg"
do
    [ -f "$i" ] && {
        sed --in-place="~$( date +%FT%T )~" "s/REPLACEME/$USER/g" "$i"
    }
done

ln -s /usr/share/backgrounds "/home/$USER/Pictures/wallpapers/shared"

mkdir -p "/home/$USER/.config/bunsen" # this should already exist
touch "/home/$USER/.config/bunsen/bl-setup"
chown -R "$USER":"$USER" "/home/$USER"

exit

Last edited by johnraff (2015-11-10 06:53:55)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

Board footer

Powered by FluxBB