View Full Version : default path to user home folder problem

22nd November 2017, 06:05 PM
Minor irritation, but just wondering if anyone else has encountered this...

Running F27, LXDE as the UI. Two drives mapped as '/ and swap, boot' and then '/home'. Using rsync I copied my /home folder to an SSD. Then shutdown and removed the HDD and put in the SSD. Everything works. Data is all there, permissions all are ok, fstab looks good (not using UUID, but /dev/sdb1), etc. But when I pull up a terminal, the path is defaulting to / rather than /home/<users>. The command 'cd ~' does put you in the right user folder, so system knows where you live. The file manager gui also defaults to /. I can get around it in the shell by adding cd /home/<users> in the .bashrc script, but just wondering why swapping drives would cause this change? I've done this before without any problems. In fact when I build a new system I usually install all on the OS drive and then change fstab to point /home to second drive after said and done to restore /home folders. I looked into this last night but didn't come up with the solution (obviously). I searched the web too, but no solution came up that fit. Of course this one is kind of hard to put into a concise 'search' ... at least for me!

22nd November 2017, 07:24 PM
UIDs maybe differs between old and new account. Check with - current uid: "id -u", old uid: "ls -lnd /home/<user>/".

22nd November 2017, 10:12 PM
In a different context, I had a system that defaulted to / as you describe which was solved by writing: PS1="[\u@\h \W]\\$ " to .bashrc. And .bashrc needs to be sourced from .bash_profile, which it usually is by default.

23rd November 2017, 12:22 AM
. Check with - current uid: "id -u", old uid: "ls -lnd /home/<user>/". Match.

[rclark@linuxRD ~]$ id -u
[rclark@linuxRD ~]$ ls -lnd /home/rclark
drwx------. 87 1000 1000 4096 Nov 22 09:02 /home/rclark
[rclark@linuxRD ~]$


That said..... I logged out and back in ... and it is working again. I did this several times last night and had the same problem. I didn't do anything... Nothing has changed.... I rebooted for a clean login and it still works. So problem is ... errrr... solved. No reason. Really dislike this type of 'solution'. :( .

2nd December 2017, 09:16 AM
I logged out and back in ... and it is working again.

The symptom seems to indicate a permission problem.

Do you have SELinux turned on? My guess is the SELinux security didn't allow access to some files in your directory, but your logging off caused some files to be updated, and in the process, set the proper security context on them.

When using rsync, be sure to add -X -A -a options so SELinux context can be preserved.

I usually force SELinux relabel whenever attaching a new partition with user home directories:

touch /.autorelabel
systemctl reboot