Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How do I auto chown all new files in a directory

    So, I have a minecraft server. And everytime a new gets generated I have to chown, or chmod it to be able to edit, or remove it vi FTP. The new files that is getting generated is in the FTP users home folder. So, how can I make the user be able to remove and edit file that hasent been uploaded by him?

    Kind Regards.

  2. #2
    you can probably do this with the setfacl command. you could run it on the dir where all the files are being put, making them owned by the user, e.g.:

    setfacl -Rm u:myuser:rwX,d:u:myuser:rwX mydir
    read the setfacl/getfacl man pages for more info and examples.

  3. #3
    Just Joined!
    Join Date
    Sep 2012
    How do I auto chown all new files in a directory ?
    A - > Set the permission on directory such that newuser will be able to create and delete file.
    This method will have to manaully set using chmod or chown which you dont want to use.
    B - > setfacl -R -d -m u:newuser:rwx newuser (as mentioned by atreyu)
    for setting up access control list on the directory.

    Directory - /example
    Now when the files are created in directory - "/example", you can automatically set the owner and
    group to 'newuser' by using setuid/setgid
    chmod u+s /example
    chmod g+s /example

    You can use vsftpd also to set the ownership of all the files that are getting created.
    file - /etc/vsftpd/vsftpd.conf
    chown_uploads = yes
    chown_username = newuser
    files created / uploaded will get the ownwer and group as newuser.

    Please do revert if you find any problems.

    Best Wishes.

  4. $spacer_open

Posting Permissions

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