RE: Changing owners recursively

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





> -----Original Message-----
> From: redhat-list-admin@xxxxxxxxxx
> [mailto:redhat-list-admin@xxxxxxxxxx]On Behalf Of Go, Jeffrey
> Sent: Wednesday, January 28, 2004 1:21 PM
> To: 'redhat-list@xxxxxxxxxx'
> Subject: Changing owners recursively
>
>
> Hello all
>
>
>
> I have a directory that I have used the command "chown -R user:group dir".
> The existing files created get their owners and groups changed.
>
> However, subsequently, when creating new files under the same
> directory, the user and group revert to root:root.
>
> What command will I need to use to make sure new files created
> have the same group?
>

Turn the group sticky bit on for all the directories.

chmod g+s [dirname]
or
chmod 1[mode] [dirname] (e.g. instead of chmod 755 dirname, chmod 1755
dirname).

You could do a

chmod -R g+s [dirname] as the group sticky doesn't affect regular file, but
if you want to keep it looking clean

find [dirname] -type d -print |xargs chmod g+s

you might want to do a

find [dirname] -type d -print |xargs ls -ld

just to get a listing of the directory names you will be chmod'ing before
you do the actual chmod

Ben


>


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux