Shiv Kumar
 Hobbyist Filmmaker / Editor

Setting up IIS 7.0 - Ftp 7.5 for IIS Manager Users

555551votes
December 16, 2009 04:20 PM  Views: 10431   Favorited: 0 Favorite It Comments: 6
Filed Under:  Programming
Tags:  Ftp 7.5, IIS 7.0
 
 
This tutorial is about setting up IIS Ftp 7.5 using IIS Manger Users under Window 7 or Windows 2008. I also assume you want to use User Isolation of "User name directory" or similar. The documentation I have found has been scarce or incomplete. Note that this tutorial is not about showing you how to use the IIS Management UI for IIS 7.0. I assume you know how to use the IIS Management UI for IIS 7.0
 

Setting up an Ftp Site

Make sure you've installed Ftp 7.5 for your operating system (32bit or 64 bit). Then set up an Ftp site. you can find a step by step here. It's not the greatest tutorial but it should work.
 

User Isolation

Besides, actually setting up user isolation using the UI in IIS Manager, you also need to create a few folders and then give the user NetworkService the proper rights to these folders and to the IIS config files.
 
You need to create the following folders as sub folder of your Ftp site's root folder. First create a folder called
LocalUser
Then under LocalUser, create a folder called
public
Under LocalUser again, create a folder with the name of the username of a windows user on the machine. You'll use this to test the ftp site. In order to test a with a windows user, you also need o have Basic Authentication turned on for yout ftp site. Do this using the Ftp Authentication icon for the Ftp you created.
 

Setting up the correct permissions

To grant Special permissions to the user NetworkService to the Ftp Root folder (using a command prompt):
CACLS "%SystemDrive%\inetpub\ftproot" /G "Network Service":C /T /E
Next the user NetworkService needs to be given permission to the config folder and two config files
CACLS "%SystemDrive%\Windows\System32\inetsrv\config" /G "Network Service":R /E
CACLS "%SystemDrive%\Windows\System32\inetsrv\config\administration.config" /G "Network Service":R /E
CACLS "%SystemDrive%\Windows\System32\inetsrv\config\redirection.config" /G "Network Service":R /E
Now you should be able to log on to the ftp site you created using the credentials of a windows user.

IIS Manager Authentication

For Windows 2008 you can follow this tutorial in order to configure Ftp with IIS Manager Authentication
Configure FTP with IIS 7.0 Manager Authentication
 
Windows 7 does not have the UI that you'll find in Windows 2008. The other issue is that you can't simply modify the administration.config file because the password is normally saved in a hashed format.
 
But you can create IIS Manager Users using Managed Code. Below is a simple method you can add to your class of choice. In order for this code to work a few references need to be added to your project.
Add the following Reference Path to your project
C:\Windows\System32\inetsrv\
 
Then added the following References:
Microsoft.Web.Administration
Microsoft.Web.Management
 
Next, add the following namspaces to
using Microsoft.Web.Management.Server;
using Microsoft.Web.Administration; 
 
The following is an explanation of the parameters this method expects. 
configurationPath - This is the name of the Ftp site. So you if called your Ftp site "Default Ftp Site", then pass in this string as the first parameter
username - The username of the new user you want to create
password - the password for the new user 
 
private void CreateFtpUser(string configurationPath, string username, string password)
{
   /* First Create the User for the ftp site */
   ManagementUserInfo userInfo = ManagementAuthentication.CreateUser(username, password);
   ManagementAuthorization.Grant(userInfo.Name, configurationPath, false);
   /* Next set up the permissions for this user (Read/Write) */
   using (ServerManager serverManager = new ServerManager())
   {
      Configuration config = serverManager.GetApplicationHostConfiguration();
      ConfigurationSection authorizationSection =
         config.GetSection("system.ftpServer/security/authorization", configurationPath);
      ConfigurationElementCollection authorizationCollection =
         authorizationSection.GetCollection();
      ConfigurationElement newElement =
         authorizationCollection.CreateElement("add");
      newElement["accessType"] = @"Allow";
      newElement["users"] = username;
      newElement["permissions"] = @"Read, Write";
      authorizationCollection.Add(newElement);
      serverManager.CommitChanges();
   }
}

Be sure to create a sub folder under the LocalUser folder (under your ftp site's root folder)for the users you create using the code above. The username of the user and the folder name should be the same.

In order to be able to use IIS Manager Users with your Ftp site, you need to have the IisManagerAuth provider enabled for your Ftp site. Do this using the Ftp Authentication icon for your Ftp site and choose Customer Providers... from the actions pane.
 
At this point, you should be able to log in to your Ftp site using the users
 

Comments



Matt    January 11, 2010 03:28 PM

Site is too dark. readability is less than desireable.

i didnt even read the article because the site is too dark. dark font on dark background sucks. might be good if you are in a dark room. not in a standard corporate office though. just doesnt work.

its a shame too, because you may have had the answer.

Alistair    January 26, 2010 05:05 AM

Readability is much better than most sites

I am in a bright office and found the background and font were easily legible and also refreshingly different from the usual high contrast glare of dark text on a white background. Matt could have a problem with his own computer settings.

Adam    October 08, 2010 11:55 PM

Site is not too dark

I am a game programmer..and all of my ide's are set up with this dark format..YOU KNOW NOTHING MATT. hahahaha. so yea...shut up

   October 13, 2010 06:05 AM

it can be the pc settings, matt. but it can also be that your background environment (the light behind the monitor) is to bright. make it more dark and see. this performance is perfect for y eyes if y have to watch a long time. herman

kursat selami    January 27, 2011 09:04 AM

Great article!

10x man..avoid me many troubles..

Roy Li    January 24, 2012 11:20 AM

Thanks man. This is help me lots.



Leave A Comment

Data Entry Error
First Name:  Last Name: 
Title:
Comment: Required Information
  Required InformationIndicates Required Information
Shiv Kumar
Gainesville, Virginia,
United States
Member Bio Member Skills/Specialization

Bio

close

Specializations

close
Photographer
Landscape
Nature
Portrait
Videographer/Cinematographer
Interview
Landscape
Nature
Portrait
 
Privacy Policy | Terms Of Service | Contact Us | Support | Help/FAQ | News