Search code examples
iisdirectorypermissionsvirtualunauthorized

How can I set permission to all new sub directories on windows server created by java?


I have a website hosted on IIS and I created a virtual directory ("pictures") which physical path is "C:/mydir/mysubdir". Inside "mysubdir" there are many sub-directories (for example: "123", "456" and so on ) containing images that are shown on the website with a regular html tag. Until now everything is working fine and images are shown, the problem occurs when the back-end application hosted on Tomcat installed on windows server and connected to IIS goes to create new sub-directory under the physical path, the images inside the new folder are not shown due to an Unauthorized access 401, the work around I'm doing is set share permission all the times the user is creating new sub-directories via webapp but you can understand that is not possible do this all the time, this must work alone. I already set all read/write permission to the Administrator account, even shared the parent folder and set the inheritance but is not working. The owner of the folder is different if create from tomcat (LOCAL USER instead of Administrator) and I don't know if this could be a problem.

Please help me to find a solution.

Thanks in advance.


Solution

  • You could try the below steps to resolve the issue:

    1)select your folder under which the new subfolder is creating by another user.

    2)Right-click on the target folder/file and select Properties.

    3)Security → Advanced.

    4)click on the add and add user application pool identity(IIS AppPool\ (eg: IIS AppPool\smartcrypt)), iis_iusrs, and iusr.

    enter image description here

    5)by clicking on show advance permission set full control. and in applies to make sure it set to this folder, subfolders, and files.

    enter image description here

    6)click on and apply the setting.

    7)in application pool identity set one of these network services, local system or application pool identity.

    enter image description here