Koozali.org: home of the SME Server

Contribs.org Forums => General Discussion => Topic started by: ReetP on October 23, 2008, 01:25:46 PM

Title: Changing file / directory permissions
Post by: ReetP on October 23, 2008, 01:25:46 PM
A note to self.........

I was trying to change a set of file and directory permissions recursively and couldn't find out how to do it. I kept on getting syntax errors.

Anyway, here is what I got to work in the end :

Change permissions :

find ./ -type d -exec chmod 0755 {} \;
find ./ -type f -exec chmod 0644 {} \;

Change ownership

find ./ -type f -exec chown owner:group {} \;
find ./ -type d -exec chown owner:group {} \;

Hope this may help someone

John
Title: Re: Changing file / directory permissions
Post by: Stefano on October 23, 2008, 02:58:46 PM
A note to self.........

I was trying to change a set of file and directory permissions recursively and couldn't find out how to do it. I kept on getting syntax errors.


changing permissions recursively is not a good idea..

what are you trying to do?

Ciao
Stefano
Title: Re: Changing file / directory permissions
Post by: mmccarn on October 23, 2008, 03:00:11 PM
While I don't know how to specify different permissions on files vs. directories as you are doing, you can apply file permissions recursively using:
Code: [Select]
chmod -R 0644 *
File ownership can be set recursively using:
Code: [Select]
chown -R user:group *

Title: Re: Changing file / directory permissions
Post by: ReetP on October 27, 2008, 12:09:14 PM
Quote
While I don't know how to specify different permissions on files vs. directories as you are doing, you can apply file permissions recursively using:
Code: [Select]
chmod -R 0644 *
File ownership can be set recursively using:
Code: [Select]
chown -R user:group *


Yes thanks, I did know that but couldn't suss changing the directory permissions recursively


Quote
changing permissions recursively is not a good idea..

what are you trying to do?

I realised that. I am having a play with Unison file synch to synchronize various bits of data across two servers. I was trying to realign permissions across a range of directories so that they showed the same permissions pre-synch. Because of various historical issues, there are a lot of identical files with different permissions........

A couple of oddities arose :

One of my servers shows files/directories owned by 'user:local' and the other by 'user:shared'

Any one have any ideas about why this occurs ?

Second thing that cropped up was that my windows boxes suddenly started to read & write files as user:user so I must have screwed something somewhere.

I got out of it by going into server manager and changing the user-access to group/group and back to group/everyone

That seemed to sort it out.

Hmmm. Back to the drawing board !

I got out of it by changing the permissions on the ibays.

Thanks for the tips. Anything else gratefully appreciated !
Title: Re: Changing file / directory permissions
Post by: ReetP on October 27, 2008, 01:19:19 PM
As a matter of interest, what SHOULD the default file/directory permissions be ?

Are they listed anywhere ?

B. Rgds
John