Many IIS 7 FTP developers may not have noticed, but all custom FTP 7 extensibility providers execute through COM+ in a DLLHOST.exe process, which runs as NETWORK SERVICE by default. That being said, NETWORK SERVICE does not always have the right permissions to access some of the areas on your system where you may be attempting to implement custom functionality. What this means is, some of the custom features that you try to implement may not work as expected.
For example, if you look at the custom FTP logging provider in following walkthrough, the provider may not have sufficient permissions to create log files in the folder that you specify:
How to Use Managed Code (C#) to Create a Simple FTP Logging Provider
There are a couple of ways that you can resolve this issue:
- First of all, you could grant NETWORK SERVICE permissions to the destination folder.
- Second, you could change the identity of the FTP extensibility process so that it runs as a user that has permissions for the destination folder.
For what it's worth, I usually change the identity of the FTP 7 extensibility process on my servers so that I can set custom permissions for situations like this.
Here's how you do that:
- Create a user account that is only a member of the built-in Guests group, that way you're always using an extremely low-privileged account on your system. (You can also set custom security policies for that account, but that's outside the cope of this blog.)
- Open Administrative Tools on your Windows system and double-click Component Services.
- Expand Component Services, then expand Computers, then My Computer, and then highlight COM+ Applications.
- Right-click Microsoft FTP Publishing Service Extensibility Host and then click Properties.
- Click the Identity tab, and then click the This userradio button.
- Enter the credentials for the low-privileged user account that you created earlier, and then click OK.
Once you have done this, you can set permissions for this account whenever you need to specify permissions for situations like I described earlier.
Personally, I prefer to change the identity of the FTP 7 extensibility process instead of granting NETWORK SERVICE more permissions than it probably needs.
Note: This blog was originally posted at http://blogs.msdn.com/robert_mcmurray/