0

I have a script that each night checks /original for all sub directories that are older than 30 days, zips them in /original and then scp's them to a remote ftp, and then deletes the zip and directory. Pretty simple.

But it is failing due to a permission error on /original and the subdirectories.

I need my user to have full permission over /original , all its subdirectories , and any new directories that are created (about 350 per day). I am unsure even after researching how exactly to do this.

  • Which operating system? Can you include the output of "ls -ld /original /original/some_subdirectory"? That would help figure out what your issue really is. – DS. Feb 28 '14 at 04:01
  • RHEL 5.3 /original = drwxrwxr-x 10622 drew apache 299008 Mar 4 12:49 /original/sumdir = drwxr-xr-x 2 apache apache 4096 Mar 1 14:08 – drew27c Mar 04 '14 at 17:52

1 Answers1

0

The permissions on directories are described using the bits that show up as drwxrwxr-x in ls -l. After the first d (for directory), there are three groups of rwx, for read-write-execute permissions for the user, group, and others, respectively.

In your example, the subdirectories are owned by user apache, group apache and only writable by the user, not the group. You probably need them to be writable by the group apache. Make sure that drew is a member of that group. Then drew would be able to delete files from those subdirectories, and the subdirectories themselves.

The ensure that those directories are created group-writable, that is usually controlled by the umask in effect when the Apache server runs. You'll want the umask of 002 for that. See this question/answer for how to do that: Setting the umask of the Apache user.

Community
  • 1
  • 1
DS.
  • 17,804
  • 4
  • 43
  • 46