If it is possible, should be pretty basic, but I am puzzled how to ask Google the right question (or it is impossible).

Lets say we have


We have homedir and some subdir.. programs will use naturally from homedir(*/home/user*)

What I need is to temporarily change home user to */home/user/candidate*, so programs will call */home/user/candidate/conf*, instead */home/user/conf*

Now, I don't need usermod or anything else to change permanently /etc/passwd, i want to temporarily force programs to use my directory, thinking it is home, but on reboot fetch */home/user* and act normal.

Using */home/user/candidate* as home only session long, no usermod stuff.

2 Answers 2


You could use bind mount to make this redirection:

mount --bind /home/user/candidate/ /home/user/

This way, /home/user will show the contents of it´s subdir candidate. After making all you need, umount will destroy the binding:

umount /home/user/

More docs about bind mount:

  • 1
    that would do perfectly if it to do as i think it will. off to another station, will let know of result Apr 25, 2014 at 18:50
  • i´ve made a test inside /tmp and it worked as expected. hope it works for you too. Cheers
    – user34720
    Apr 25, 2014 at 19:01
  • 1
    seems perfect. as i was thinking, it isnt hard, after you know what to look for.. google answers gave usermod answers, and i can assume i asked wrong questions Apr 25, 2014 at 19:01
  • Another option is aufs, that is something like a overlay filesystem to multiple directories into one mountpoint. Could be usefull to make /home/user read-only and /home/user/foo read-write. I just don´t if it will work as mount bind with subdirs. - aufs.sourceforge.net
    – user34720
    Apr 25, 2014 at 19:23
  • Any reason why you wouldn't want to just export HOME=/home/user/candidate? Mar 17 at 10:46

A more portable, fleeting solution that doesn't involve mounting one folder over another (yuck) is to just export HOME=/home/user/candidate.

  • 2
    If you run HOME=/home/user/candidate "$SHELL" you get a shell with a displaced HOME. Type exit to exit that shell.
    – they
    Mar 17 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.