Giving writing permissions for IIS user at Windows 2003 Server - iis

I am running a website over Windows 2003 Server and IIS6 and I am having problems to write or delete files in some temporary folder obtaining this kind of warmings:
Warning: unlink(C:\Inetpub\wwwroot\cakephp\app\tmp\cache\persistent\myapp_cake_core_cake_): Permission denied in C:\Inetpub\wwwroot\cakephp\lib\Cake\Cache\Engine\FileEngine.php on line 254
I went to the tmp directory and at the properties I gave the IIS User the following permissions:
Read & Execute
List folder Contents
Read
And it still showing the same warnings.
When I am on the properties window, if I click on Advanced the IIS username appears twice.
One with Allow type and read & execute permissions and the other with Deny type and Special permissions.
My question is:
Should I give this user not only the Read & Execute permissions but also this ones?:
Create Attributes
Create Files/ Write Data
Create Folders/ Append Data
Delete Subfolders and Files
Delete
They are available to select if I Click on the edit button over the username.
Wouldn't I be opening a security hole if I do this?
Otherwise, how can I do to read and delete the files my website uses?
Thanks.

Finally what I did was giving read/write/modify permissions on app\tmp folder for the Internet Guest Account.

Related

How do you allow IIS to access a symlink folder?

I have a two webservers, on each webserver in the C:\inetpub\logs\LogFiles I have created a symbolic link to the other servers log file folders, so essentially I can be logged in to one of the webservers and see the logs on both servers in one place. This works perfectly.
I am building a webpage to make the log files available via a webpage, the code simply goes to the C:\inetpub\logs\LogFiles directory and lists the files in each sub folder, i.e. W3SVC1 (the local folder) and webserver2-w3svc1 (the remote log folder).
For the local folders it works fine, but I am getting the "access denied" error when trying to call Directory.GetFiles on the symlinkd folder. I suspect this is some sort of permissions error, but I tried giving the symlinkd folder full permissions to "everyone" but I still get the same error.
Is this something to do with the fact that when I created the symlinkd I had to enter the username and password of the webserver2, and these credentials cannot be accessed/used by IIS when trying to get access to the folder?
Is there anything I can do allow IIS to access the contents of this symlinkd folder?
I don't think you need to use a symlink, you can create a virtual directory mapping to that directory in IIS, just map it to the target path. In IIS, right click on the website and select Add Virtual Directory.
For more information, please refer to this official document.
After much experimentation, the only way to do this is as follows:
Create a new user on the computer.
Run the AppPool in IIS under this new users' identity as opposed to the default IUSR account.
Give the folder you are sharing permissions to this user AND 'share' this folder with the new user.

Access denied when calling ExportToStream() from a .rpt file

I run my web app in IIS (Windows Server 2012 R2) - which uses XML and an .rpt file to generate a PDF. When trying to use ExportToStream() in debug mode, I get this exception:
Access denied. The file may be in use by another program.
I thought this had something to do with permissions on folders, but I wasn't able to fix it. How can I stop my permissions from being denied?
It should the User you logged in into that computer, then set folder access to full control.
Access denied. The file may be in use by another program.
This Error says the file is already open, Check it in task manager and kill it.
Close all PDF file too..it should be open with same name as you generate a new pdf,It must be unique name.
The permissions were denied because I was using a temporary file, located in C:\TEMP. Adding the group "Everyone" with Full Access solved the problem.

How do I set permissions on dynamically linked files?

I have an InstallScript installer that utilizes dynamic file links for several components. These components contain configuration files that standard users should be able to edit. We recently discovered that when these files are installed on Windows Server 08, the permissions are set to full access for the Administrators group, but only read & execute access for the Users group. The typical install location is C:\programName.
I've tried creating new files manually as an admin (right click - new text file) in the C:\programName directory, and they are generated with identical permissions. I'm assuming that this is just the standard permission setup for new files.
Is there any way, within InstallShield, to set the permissions for dynamically linked files or the directory containing them?
I've looked for permission settings in
Organization -> Components
Application Data -> Files and Folders
but I haven't found anything. The documentation on dynamic file links makes no mention of permissions.
We are using InstallShield 2010.
Generally these permissions are a good thing; they're inherited from their parent folders. Non-administrator users (including the limited access admin before accepting a UAC prompt) should be unable to modify files under Program Files or C: so I would suggest addressing this concern in your application (for instance by using each user's Documents folder). Since you don't talk about why you need it, it's hard to say with certainty if this applies to your case.
If it turns out it does make sense to address this in the installation instead of the application, you can use the SetObjectPermissions API to set permissions programmatically.
In "Files and Folders" page right-click the file or folder, select Properties and click the Permissions button. In the "Permissions" dialog you can then right-click in the Name(s) list and use the New context menu option to add a new permission.
If the option is not available for a file, you can try setting it on the parent folder.

Windows 7 Security Policy: How Do I Allow My .NET App to Write to Drive "C:"?

My application is not supposed to perform any administrative tasks, so I want a normal User account to be able to run it. Only thing is, my application reads from and writes to a database file; if the user running Windows 7 (Or Vista) installs my app in drive C, the drive's default permission set configuration doesn't allow my app to write data.
How can I allow my app to write to C:, without requiring full administrative privileges?
If the database file exists at install time you can just grant the user write access to the file as part of the installation process (ordinary users do not have this permission by default). If the file needs to be created by the program the user running the program will need modify permissions on the c drive, which is not something that I would recommend.
I'd suggest storing your db file in Documents and Settings / App data / your app / directory. It exists specifically for this purpose. Writing to C:/Program Files is not so good practice. If that's possible in your case, that is.
You need to open UAC (User Account Access) and set security slider to the bottom. Then you can access drive C: as you did in windows XP.
I decided to modify directory permissions in the setup process, so I created an .exe file that changes the permissions of its start-up path, and gives all users access to that path. I simply included that .exe file in my deployment project, and created a Custom Action that would run the file in the Commit phase of installation.
Because the setup asks the user for administrative rights when it is being installed, my .exe also enjoys administrative privileges and can modify the permissions of the installation directory.
In my .exe, I used a Process instance to run the ACL utility shipped with Windows (icacls.exe) as follows:
ICACLS.EXE [TargetDir] /T /C /grant Users:F
(Make sure that [TargetDir] doesn't end with a "\" or the call will fail.)
This gives all users full control access to the target directory.
I could also write .NET code and change directory permissions manually, but I'm a little lazy!
You may however want to inspect your environment conditions thoroughly so that what you do wouldn't become a security hole in your environment; but this was suitable for me.
I hope this helps others who faced the same issue.
The user by default should have write permissions to drive C:, if not, then you will need to change the directory you read from and write to, to the executing directory (C:/Program Files/Your App/) rather than the root of C:
You can get this by
String Path = Path.GetDirectoryName(Application.ExecutablePath);

cannot edit permission for a folder

I am using Windows Server 2008 x64. I login using administrator. I want to add a new user for read/write access for a folder under c:\windows\system32. I tried to select folder (right click), then select Property -> Security -> Edit under Security Tab, the Add button is greyed out. Why? Any programming based or other quick solutions?
I tried the same operation under other non-windows system folder, it is ok to add new user to permission.
thanks in advance,
George
If the folder doesn't give administrator permission to edit the folder's settings then administrator can't edit the folder's settings.
One answer that would belong on Server Fault is that if administrator can take ownership of the folder then administrator can edit the folder's settings to give administrator permission to edit the folder's settings (this part seems recursive).
Programmatically, you could write a program which would edit the folder's settings. If administrator executes the program, it will still fail. If administrator installs the program as a service, to execute under the Local System account, the program will have a better chance of success.

Resources