NFS Home directory creation: include a .bashrc

Issues related to applications and software problems and general support
Post Reply
dmaarten
Posts: 5
Joined: 2020/02/19 14:33:15

NFS Home directory creation: include a .bashrc

Post by dmaarten » 2020/02/19 15:03:27

We have an LDAP-setup with an automounter to point users towards their home folder on some NFS share. When a user logs in for the first time, a lot of folders are created: Downloads, Desktop,... I assume this happens when Gnome finds an empty home directory. (correct?)

Where is this folder layout defined? I'm asking as I would like to add a default .bashrc upon user first log in.

Whenever I google this, I end up with someone explaining /etc/skel. I understand this is the case for local user creation. In my case, the user is added to ldap and centos just find an empty home directoy and performs some magic. It seems like this is a different system. I might be wrong, but I see no similarities between the files added to an empty home, and /etc/skel.

Thanks!

BShT
Posts: 584
Joined: 2019/10/09 12:31:40

Re: NFS Home directory creation: include a .bashrc

Post by BShT » 2020/02/19 16:45:31

probably you should set skel at user PC not at NFS server

sml
Posts: 305
Joined: 2020/01/17 09:01:44

Re: NFS Home directory creation: include a .bashrc

Post by sml » 2020/02/19 18:29:36

@BShT No, setting skel at user PC won't work: it's used only when a new home directory is created, while here existing home directories are mounted from an NFS server.

@dmaarten Why not just copy files from skel, when creating user home directories on the NFS server?

Alternatively, at user PCs, pam_exec may be used to copy anything you need, but it will be executed on each and every login, not just on the first one.

dmaarten
Posts: 5
Joined: 2020/02/19 14:33:15

Re: NFS Home directory creation: include a .bashrc

Post by dmaarten » 2020/02/20 12:30:10

Thanks @BShT , @sml.

Pam_exec might be an interesting option and I'll definitely explore that route.

I'm still curious to how the Documents, Picture, Music, .. folders are created on first user login. Any idea about that? I can't explain it, but I have high hopes for hooking in to this one, no idea why :) Somehow it just seems as the cleanest setup: create the bashrc along with all other files and folders on first login.

Cheers,
Maarten

sml
Posts: 305
Joined: 2020/01/17 09:01:44

Re: NFS Home directory creation: include a .bashrc

Post by sml » 2020/02/20 13:27:18

They are created by xdg-user-dirs-update that gets invoked in /etc/xdg/autostart/xdg-user-dirs.desktop upon login. See also an explanation in ArchWiki.

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: NFS Home directory creation: include a .bashrc

Post by hunter86_bg » 2020/02/20 20:59:09

This task is most suitable for configuration manahement like puppet, chef, salt, ansible.
Anyway, someone should create that space on the NFS server,right ?
It can't get on the NFS server magically - so you need to take care there.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: NFS Home directory creation: include a .bashrc

Post by TrevorH » 2020/02/21 01:15:53

Could also be a job for oddjob-mkhomedir.x86_64
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply