3

I'm modifying the $HOME variable on a /etc/profile.d script. This seems to be OK for console sessions.

There are some caveats on graphical sessions, though: Gnome won't load my desktop configuration, it will still use the HOME defined on the passwd. Bizarre enough, If I open a terminal, the $HOME variable is the one defined by me on the /etc/profile.d script.

I'm doing this because I'm rsyncing the home against a NFS server, and I want to provide an alternative login method by mounting the NFS home directly, for occasional logins. Since at this stage root has already created the home directory, my plan is to link the NFS mount inside it, and modify the $HOME variable.

4
  • How did you ensure GNOME starts with the $HOME you want it to start with? Are you starting GNOME through startx in a running shell? If not, GNOME won't even dream about the contents of /etc/profile.d, as this is used by shells. You may want to change some file (~/.xprofile or its system-wide counterpart?) if you are using a graphical login screen. Meanwhile, I'm curious, why don't you just change /etc/passwd to point to what you want $HOME to be, or why don't you simply mount the NFS folder over /home or wherever your system has home directories?
    – njsg
    Jan 28, 2013 at 18:44
  • I'm starting GNOME with lightdm. I think that the contents of /etc/profile.d/ are run because I'm doing other stuff and it's actually being done. I can't change /etc/passwd because passwd is gathered from a LDAP server. I do this on 2 steps: The first step as root, run through pam_exec, mounts the NFS share elsewhere and ensures that the home directory exists. The second step as user, runs through /etc/profile.d scripts and does the rsyncing or the linking stuff. Since the user directory already exists and the parent is owned by root, I can't delete it and replace it by a link. Jan 28, 2013 at 19:50
  • How are you checking if the stuff from /etc/profile.d/ is run? Is there any graphical application that you don't start from a terminal emulator and which does have the updated values?
    – njsg
    Jan 28, 2013 at 21:58
  • I run a yad dialog showing the progress of the rsync. It's called from a /etc/profile.d/ script, and it's being displayed. Also, the rsync is done, so... Jan 28, 2013 at 22:22

1 Answer 1

0

Better cut this out, and just shut the users (or even just each user) out while you move the data over. If you have people logging in, they will modify the data to be copied over, and then you'd have to restart the copy. Rinse and repeat until you've got it all. Then switch over, but you can't do that while they are logged in. Et cetera. To iron out the bugs in any such a scheme is a lot of work, and if it is just a temporary measure, forget about it. Too much work, too much risk.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .