11

I need to allow members of the group 'ftpusers' to be able to change permissions on all objects inside a certain directory. I was looking into how to do it but all I have found is how to do it on BSD:

chmod +a "ftpgroup allow writesecurity" /some/dir

I need exactly the same thing but for Debian/GNU.

Thanks

2
  • What type of filesystem are you using? What is the current permissions?
    – Zoredache
    Mar 25, 2010 at 18:49
  • Filesystem is ext3. Current permissions: drwxrwxr-x 9 drasko ftpgroup 4096 2010-03-25 10:20 dirname
    – Drasko
    Mar 25, 2010 at 19:30

3 Answers 3

9

Only the owner of a file or root is permitted to change permissions in Linux (write access != permission change access)

The only way I can think of is using sudo. I don't know if that would do the trick, and I'd be exceedingly cautious about how you specify the sudo rules so that the users don't have any additional privileges.

Note that if they are connecting using an FTP server, sudo probably won't be the answer.

1
  • 1
    The chmod(1) man page helpfully fails to mention this rather important point.
    – Jeremy
    Mar 9, 2018 at 15:49
2

One solution (which I've had to use) is a cron job going through and changing the permissions of a specified directory and files under it. Not pretty but it works.

If you want to extend the ability of users to change this, you might consider allowing the users from the ftpgroup to allow chmod within the specified directory with an appropriate rule using sudo.

Or you can make a shell script which does the appropriate checks and does the function, and make that program allowed to be run via sudo. I do not suggest nor recommend a set-uid shell script.

1

Just give the 'ftpusers' write permissions and ownership on that directory:

chgrp ftpusers <directory>
chmod g+rwx <directory>

And then set the GID bit so all new files inherit group ownership:

chmod g+s <directory>
4
  • 2
    That was my thought exactly but it doesn't work, I get 'Operation not permitted' if I try to change anything
    – Drasko
    Mar 25, 2010 at 18:46
  • What are the current permissions?
    – Vitaliy
    Mar 25, 2010 at 19:04
  • drwxrwxr-x 9 drasko ftpgroup 4096 2010-03-25 10:20 dirname
    – Drasko
    Mar 25, 2010 at 19:31
  • just created new dir apps with 777, it created using my default group now trying chmod g+s apps ? it says operation not permitted
    – amit patel
    May 24, 2017 at 22:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .