I have a Ubuntu 16.04 client computer that is connected to LDAP (FreeIPA). It takes its users from IPA LDAP. Accordingly, we have a mkhomedir directive in
/etc/pam.d/common-session file that creates home directory automatically.
session required pam_mkhomedir.so skel=/etc/skel/ umask=0022
I have written a small customization script for Unity Desktop for every user that logs in to the Desktop. Now, we want to run this script each time a user/new user logs in. Because, we want all users to see a standard Desktop.
My configuration is as below:
Login script to run:
$ cat /usr/bin/login.sh #!/bin/bash dconf reset -f / xdg-settings set default-web-browser google-chrome.desktop gsettings set org.gnome.desktop.session idle-delay 0 gsettings set org.gnome.desktop.screensaver lock-enabled false gsettings set com.canonical.Unity.Launcher launcher-position Bottom dconf write /org/compiz/profiles/unity/plugins/unityshell/icon-size 24
LightDM config that I have changed:
$ cat /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf [Seat:*] greeter-session=unity-greeter greeter-show-manual-login=true greeter-setup-script=/usr/bin/numlockx on session-setup-script=/usr/bin/login.sh
LightDM under this config runs the script every time a user, that logged in before, logs in. But when a new user without home directory tries to login there is a login loop that directs the new user to greeter again.
After auditing we have realized that the automatically created home directory of the newly logged in user is created with ownership root:root
drwx------ 6 root root 4096 Jun 7 12:10 newuser/
This only happens if the user has never logged in before.
I tried putting session-setup-script under
/etc/lightdm/lightdm.conf with the variations as below:
$ cat /etc/lightdm/lightdm.conf [Seat:*] user-session=ubuntu greeter-session=unity-greeter session-setup-script=/usr/bin/login.sh $ cat /etc/lightdm/lightdm.conf [SeatDefaults] user-session=ubuntu greeter-session=unity-greeter session-setup-script=/usr/bin/login.sh $ cat /etc/lightdm/lightdm.conf [LightDM] user-session=ubuntu greeter-session=unity-greeter session-setup-script=/usr/bin/login.sh
Also tried to put
None of these approaches worked. The same behavior!
As a result, when I try to run this script new users without home directories cannot login to Unity. But if the user has logged in before (home directory created with correct ownership) they can continue using Unity with the customization.
I made searches about lightdm, pam and linux logon script. But couldn't find and answer to this problem. Can anybody help what to do to create the home directory of new users with the correct permissions?