Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 3791  / 1 Year ago, tue, may 2, 2023, 5:34:56

I've upgraded an Ubuntu PC from 10.04 to 12.04.



Problem is all the permissions were wrong on the home folders.



So, I did the following:



sudo chown -R james:james /home/james/*
sudo chown -R james:james /home/james/.*
sudo chown -R htpc:htpc /home/htpc/*
sudo chown -R htpc:htpc /home/htpc/.*


But you end up with all the files in both folders either in james:james or htpc:htpc, depending on which way round you run the commands.



How have the become linked and how can I fix it?



As requested:



james@htpc:~$ ls -l /home
total 8
drwxr-xr-x 41 james james 4096 May 20 19:32 htpc
drwxr-xr-x 31 james james 4096 May 20 20:04 james
james@htpc:~$ ls -l /home/htpc
total 236
drwxr-xr-x 4 james james 4096 Nov 25 13:19 Desktop
drwxr-xr-x 2 james james 4096 Mar 13 2011 Documents
drwxr-xr-x 5 james james 4096 Dec 22 2010 Downloads
-rw-r--r-- 1 james james 179 Nov 18 2010 examples.desktop
-rwxr-xr-x 1 james james 85 Dec 27 2010 goback
-rw-r--r-- 1 james james 425 Nov 28 2010 modelines
drwxr-xr-x 5 james james 4096 Dec 27 2010 Music
drwxr-xr-x 22 james james 4096 Oct 29 2012 Pictures
drwxr-xr-x 2 james james 4096 Nov 18 2010 Public
drwxr-xr-x 2 james james 4096 Nov 18 2010 Templates
-rwxr-xr-x 1 james james 251 Dec 27 2010 testmode
drwxr-xr-x 2 james james 4096 Dec 23 2010 Videos
-rwxr-xr-x 1 james james 190672 Nov 6 2010 winetricks
james@htpc:~$

More From » 12.04

 Answers
7

It is because the shell is expanding the ".*" to be ".." or up one directory.



In this case it is best, IMO, to use find



Become root



sudo -i


run find



find /home/$user -exec chown $user:$user {} ;


Change $user to the appropriate user name



In theory, chown should work with the -R and without the wildcard



sudo chown -R $user:$user /home/$user


but I think this misses the hidden or .files, which is why RoboJ1M tried ".*" which caused the problem.


[#31122] Wednesday, May 3, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rinstracte

Total Points: 221
Total Questions: 114
Total Answers: 120

Location: France
Member since Fri, Jan 28, 2022
2 Years ago
;