You are not logged in.

#1 2012-01-20 23:21:31

KLIM
Member
Registered: 2010-11-18
Posts: 33

[Solved]Change permissions home dir

Hello!

I've just intalled archlinux on my laptop, after using it on my desktop for a while. How ever I wanted the machines to be almost the same, so I copied the home directory.

This went wrong at some point. Maybe because I used sudo at first point for copying the home directory over.
Why I did was:

sudo cp -a /media/mnt/klim /home/klim

But after it were complete I saw root had permissions to everyhing in the directory, so I used chown

sudo chown -R klim:users klim (from /home)

What concerns me is that the old directories has some strange permissions / other permissions than the new ones.
As you can see on this screenshot:
http://i.ole.im/img/krvesv.png

The directories ok and usr are created from my laptop. My desktop has the same permissions for all directories as ok and usr

How do I change the permissions back, so it's the right ones?

Last edited by KLIM (2012-01-22 20:17:51)

Offline

#2 2012-01-21 00:14:36

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,682

Re: [Solved]Change permissions home dir

The problem is probably because the volume you used to transfer your home directory was formatted with ntfs.  Unfortunately, ntfs has no concept of linux permissions.  The only way to get around this would be to use tar (or similar) to transfer the directory.  You could use chmod -R ... to change each file/directory to match the source.

Last edited by skunktrader (2012-01-21 00:15:35)

Offline

#3 2012-01-21 11:48:50

KLIM
Member
Registered: 2010-11-18
Posts: 33

Re: [Solved]Change permissions home dir

You are absolutely right, I used a NTFS formated drive to move the directory. But if I tar my home directory on my desktop. Can I then use NTFS drive for moving the file to my laptop and extracting it there, and it will still have the same permissions?

Offline

#4 2012-01-21 15:48:56

theta
Member
From: India
Registered: 2010-01-16
Posts: 174

Re: [Solved]Change permissions home dir

There's a simple way to get the permissions of ok and usr directory on all files and directory. Just execute the following command in your home directory:

chmod -R 755 *

But be sure you want these permissions for all the directories/files.

Offline

#5 2012-01-21 17:29:38

lastchancetosee
Member
From: Berlin
Registered: 2009-02-19
Posts: 131

Re: [Solved]Change permissions home dir

KLIM wrote:

Can I then use NTFS drive for moving the file to my laptop and extracting it there, and it will still have the same permissions?

Yes, if you create the archive/extract the files with the '-p' ('--preserve-permissions" / '--same permissions') and '--same-owner' option.

Create archive:

tar --same-owner -p -cf <tarname.tar> <directories to tar>

Extract archive into current directory:

tar --same-owner -p -xf <tarname.tar>

The second command will require superuser privileges if you try to extract files that you do not own. Omitting '--same-owner' will still preserve permissions, but change ownership of all files to the current user. If your home directory only contains files belonging to you, you don't need '--same-owner'.

Last edited by lastchancetosee (2012-01-21 17:30:36)


My ship don't crash! She crashes, you crashed her!

Offline

#6 2012-01-22 20:17:37

KLIM
Member
Registered: 2010-11-18
Posts: 33

Re: [Solved]Change permissions home dir

Thanks a lot for the replies, it's solved now. I used the tar method for moving my files. Had some struggling with the hidden files got it solved though by first extracting the whole home directory to a directory inside my home directory on my laptop. Then afterwards moving the files and used this command for moving the hidden files:

find . -mindepth 1 -maxdepth 1 -exec mv -t.. -- {} +

Offline

Board footer

Powered by FluxBB