Permissions problem

Hram Admin 290 Reputation points
2025-08-27T11:14:20.5433333+00:00

Hello,

Consider the following test:

  1. On Server1 I create a test folder C:\TESTС with two subfolders - REPORTS and storage.
  2. Share C:\TESTС using Advanced Sharing for the single local account (Task) - full controll.
    01
  3. Do NOT add Task account on the NTFS permissions tab:
    02
  • as a result both subfolders - REPORTS and storage inherit permissions from C:\TESTC WITHOUT permissions for Task account.
  1. I map the J: to the C:\TASKC under Task account (I can do it because share permission = FC) and try to copy some folder to C:\TASKC\storage (J:\storage) and write the log to C:\TASKC\REPORTS (J:\REPORTS)
    04-1

Since the Task account does NOT have any write permissions to C:\TESTC (it's neither a member of the Administrators local group nor has been purposely applied write permission on the NTFS tab - it has only read permissions due to its membership in the Users group ) the copy operation should fail when

  1. copying to J:\storage
  2. writing the log to J:\REPORTS.
  1. The result: copy operation fails with the Access Denied error as expected but the log is successfully created in the J:\REPORTS folder UNDER the local Task account (I enabled File Access audit and checked it) in the folder that does NOT HAVE WRITE PERMISSION for the Task account:
    Result.1

???!!!

Regards,
Michael

Windows for business | Windows Server | Devices and deployment | Other
0 comments No comments
{count} votes

8 answers

Sort by: Most helpful
  1. Hram Admin 290 Reputation points
    2025-11-13T08:53:36.3366667+00:00

    Hello MotoX80,

    This -

    "test" | out-file J:\Storage\Storage-Test.txt

    "test" | out-file J:\Reports\Reports-Test.txt

    copy-item J:\Storage\Storage-Test.txt J:\Reports copy-item J:\Reports\Reports-Test.txt J:\Storage

    ... -works perfect:

    12

    11

    But the script still does not:

    13

    I also tried to copy the folder D:\TEST (instead of D:\STORAGE - to rule out the possible issues with the SOURCE folder, maybe it is excessive step since the error in the log clearly states the access is denied to J:\STORAGE - NOT to the source folder but...) but the result was exactly the same.

    And the icing on the cake - I tried to copy the D:\TEST folder to J:\Reports - NOT to J:\STORAGE, e.g. to the folder in which even the script is able to create its logs:

    16

    Once again: the same script raises Access Denied error when trying to copy some files to J:\Reports and successfully writes the log to the same J:\Reports folder!!!

    What am I missing here???

    Regards,
    Michael Firsov


  2. Hram Admin 290 Reputation points
    2025-11-17T09:13:20.17+00:00

    "If you want to use this TASK account to copy files, then remove the CreatorOwner ACL and grant TASK full control.

    If you need to maintain the owner attribute of the source files then use robocopy's /COPY:DATO switch." - yes, I agree - thank you!

    I just want to perceive what am I seeing in this particular case:

    1. these files - when copied MANUALLY -

    "test" | out-file J:\Storage\Storage-Test.txt

    "test" | out-file J:\Reports\Reports-Test.txt

    copy-item J:\Storage\Storage-Test.txt J:\Reports copy-item J:\Reports\Reports-Test.txt J:\Storage

    ...were copied in PS session run as backupserver\admin account but in which the J: drive was mapped under backupserver\task account (which does not have any permissions on J:)

    The result: the files have been copied successfully and the owner for both files (Storage-Test.txt and Reports-Test.txt) is set to backupserver\task account (the account under which the J is mapped).

    As far as I understand this does work due to the destination's Creator Owner permission (in this case the Creator Owner is the account under which the J: drive is mapped).

    2 when I try to copy some folder (even the newly-created D:\Test folder with the default owner set to backupserver\admin) to the same J:\REPORTS folder by running the script - the script does write the log AND SET THE OWNER TO THE SAME backupserver\task account BUT REFUSES TO COPY THE FOLDER ITSELF - I just don't understand what's the difference for robocopy between these two actions (write the log to J:\REPORTS that succeeds and the folder copy operation to J:\REPORTS that throws the Access Denied error) ???

    ...this is a rhetorical question so thank you so much for your help once again!

    Regards,

    Michael Firsov

    0 comments No comments

  3. Hram Admin 290 Reputation points
    2025-11-18T07:16:50.81+00:00

    "If you want to use this TASK account to copy files, then remove the CreatorOwner ACL and grant TASK full control.

    If you need to maintain the owner attribute of the source files then use robocopy's /COPY:DATO switch." - yes, I agree - thank you!

    I just want to perceive what am I seeing in this particular case:

    1. these files - when copied MANUALLY -

    "test" | out-file J:\Storage\Storage-Test.txt

    "test" | out-file J:\Reports\Reports-Test.txt

    copy-item J:\Storage\Storage-Test.txt J:\Reports copy-item J:\Reports\Reports-Test.txt J:\Storage

    ...were copied in PS session run as backupserver\admin account but in which the J: drive was mapped under backupserver\task account (which does not have any permissions on J:)

    The result: the files have been copied successfully and the owner for both files (Storage-Test.txt and Reports-Test.txt) is set to backupserver\task account (the account under which the J is mapped).

    As far as I understand this does work due to the destination's Creator Owner permission (in this case the Creator Owner is the account under which the J: drive is mapped).

    2 when I try to copy some folder (even the newly-created D:\Test folder with the default owner set to backupserver\admin) to the same J:\REPORTS folder by running the script - the script does write the log AND SET THE OWNER TO THE SAME backupserver\task account BUT REFUSES TO COPY THE FOLDER ITSELF - I just don't understand what's the difference for robocopy between these two actions (write the log to J:\REPORTS that succeeds and the folder copy operation to J:\REPORTS that throws the Access Denied error) ???

    ...this is a rhetorical question so thank you so much for your help once again!

    Regards,

    Michael Firsov

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.