Results 1 to 4 of 4

Thread: Linux set group ownership upon copy

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Linux set group ownership upon copy

    Hello,

    Our data servers have different group ownerships for each file on them. I need my local copies of the files to have their group ownership set to the proper group. Is there a property of the target directory on my local machine that I could change to obtain this result ?

    I have tried to look at masks, umask etc., but as I understand these are user properties; I am looking for a property of a directory; i.e. anything that gets copied to that directory would inherit the group ownership of the directory.

    Any help/explanation appreciated,

    Many thanks

  2. #2
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,500
    Thanks
    17
    Thanked 789 Times in 507 Posts
    Rep Power
    10

    Default

    Use chmod command to set such ownershilp on directory and than whatever you copy in target directory it will try to inherit the group ownership of the directory.

    Code:
     chmod 2775 /path/to/target
    Normally whenever you creates file in a directory it belong to default group of user. When a file is created in a directory with the sgid bit set it belogns to the same group as the directory.
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  3. #3
    Junior Member
    Join Date
    May 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    great, that works thanks ! Could never make sense of these "sticky" tags, in this context they now make perfect sense.

  4. #4
    Senior Member
    Join Date
    Jun 2007
    Location
    Hyderabad, AP, India
    Posts
    806
    Thanks
    44
    Thanked 55 Times in 48 Posts
    Rep Power
    12

    Default

    Want to add some more things to what Nixcraft said.. though they are complex but worth to know..

    as Nixcraft said to set 2775 permissions, this permissions have two limitations
    1)These permissions will not be set to sub directories/files..
    so better do..

    Code:
    chmod -R 2775 /path/to/folder
    2)You should know that chmod will change the permissions to present and existing directories/files not for the folders/files going to be created in that directories ie.. for new files created in this directories these permissions will not take effect..

    So what to do for applying these permissions to new files/folders going to be created in that?
    we should use acls for this and set umask as

    Code:
    setfacl -d -m mask:007 /path/to/dir
    Note:inorder to set ACLs acl should be enabled on the partitions..

    Please correct me if I am wrong..
    Thanks,
    Surendra Kumar Anne
    Linux: Fast, friendly, flexible and .... free!
    Support Open source.
    http://www.linuxnix.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Solved] Change Ownership Of a Web Server Directory
    By vamsi in forum Web servers
    Replies: 2
    Last Post: 2nd January 2010, 08:27 AM
  2. Script To Copy Files From Windows XP To Linux Server
    By haykins in forum Shell scripting
    Replies: 6
    Last Post: 18th September 2009, 12:12 PM
  3. [Solved] How to copy fonts file in UNIX / Linux?
    By tonjaa in forum Ubuntu / Debian
    Replies: 2
    Last Post: 12th July 2009, 06:14 PM
  4. Linux Copy an audio cd / track to hard disk
    By Peterrodg in forum Getting started tutorials
    Replies: 2
    Last Post: 12th January 2008, 10:50 PM
  5. Replies: 2
    Last Post: 17th July 2006, 01:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •