IIS User Directory like linux public_html - windows

I am familiar with Linux, less with IIS. I have been using Linux/Apache to share user directories for a while set up like this:
/home/user1/public_html
/home/user2/public_html
etc.
...and users can type in a URL to view their public files at:
http://www.mycompany.com/~user1/
http://www.mycompany.com/~user2/
etc.
Combined with SMB sharing and drive mapping on client windows boxes makes it very convenient for corporate users to drop files into a publicly available folder temporarily for someone else to download. They just email the other person the URL.
Searching the internet for "IIS public folders" and variants, yields OWA and Exchange results which I don't want. What is the proper terminology for this setup in Windows/IIS? How do you do it in Windows for all domain users?

In IIS you have to create a virtual directory for each user. IIS does not have an equivalent of the Apache UserDir directive. That's because IIS does not have a concept of users (in the sense of a subscriber to a webserver host).
Of course you could roll your own definition of who users are in IIS. In IIS 7, things like virtual directories are stored in an XML file ApplicationHost.config. You can either create the virtual directories manually via the ISS console, or programmatically via the ApplicationHost.config file.
Reference:
(1) http://www.advancedinstaller.com/user-guide/tutorial-iis.html#virtual-directory
(2) http://httpd.apache.org/docs/2.0/mod/mod_userdir.html#userdir
(3) http://learn.iis.net/page.aspx/124/introduction-to-applicationhostconfig/

Related

Secure windows service config file

I have a windows service with an accompanying config file. The service is going to be installed on a bunch of lab computers and monitor things such as diskspace, network connectivity, logins, etc.
After a set interval, it will report the statistics to a Database. In order to connect to the DB, I currently have the application user's name and password stored in the connection string, which can be found in the config file.
What's the best way to secure this, such that regular users cannot access it? We do a similar thing here with our webapps using the Web.config, and we have IIS setup such that people can't browse into the directory and read it.
Is there a best practice to securing a config file stored locally on each machine for a windows service?
Use the same method that you would use for web.config
1- Go to the windows service folder, where configuration file is located
2- Rename the config file to web.config (back it up first)
3- Execute:
c:\Windows\Microsoft.NET\Framework64\[the asp versino]\aspnet_regiis.exe -pef "[name of the config file to encrypt]" .
4- Rename the web.config back to the original name
More info here
https://msdn.microsoft.com/en-us/library/zhhddkxy.aspx

Using a link/junction between web servers

I am trying to figure a way of connecting 2 web server's file systems together so they can access each others files natively. The servers are Windows 2012 and connected directly to the internet via public IPs. One server will be for storing large files, the other for the scripts and database (web server).
Essentially, I need a way to securely map a drive/folder between these servers so they show as folders e.g. the "d:\www\assets" folder is actually on the other sever (junction). As this link needs to be accessible to the SYSTEM (apache service) not a single user, a mapped drive is not ideal. Open, unsecured shares are also not a good idea.
Playing with junctions and links in the console doesn't show any method to provide a login/password to the remote system. The junction is created but inaccessible. If I map a drive, it is only for that user and not available to the SYSTEM account that Apache is using. If I run Apache as a user and map a drive as that user, it likely won't survive a reboot or work without being logged in on the console all the time.
Are there any native ways to hook these 2 servers together securely? I have full admin access on both servers and can create as many users as required, but they are not in a domain or potentially even on the same subnet.
You may be able to use to a directory symlink via cifs/windows share considering you have have access to the local disk on one of the servers and the your sharing the the folder you want to symlink
for example:
on server a:
1. navigate to server a's local disk: d:\www\
2. mklink /d assets \serverb\assets
option 2DFS (unconfirmed)
if you can create a dfs on server on one user windows boxes, i believe you set dfs target to point folder assestes to \serverb\assets

How to protect (or lock) Apache Server folder in Windows 7

I am running PHP 5 and MySQL with Apache 2 in my Windows 7 PC. Everything (in localhost) is working fine and the localhost is defined in port 80 (It works!). But I would like to password protect (or lock) and hide server folder including htdocs. I mean, I don't want want another user to access the server folder and files. I know that I can remove installation information from add/remove programs menu by removing registry entries (hope it won't affect the server framework). But how can I prevent the users from accessing the server folder? The server folder is a master folder, in which I installed Apache, PHP and MySQL. I made it in C: drive(to ensure security). I want to lock the master folder (password protected). Only I should have the access to them (my friends use my PC). But the content (localhost) should be delivered (I mean the pages should come, along with PHP and MySQL) for everyone. Only a single user account is there (Admin).
How can I lock and hide my folder while running server silent/hidden. Is this possible with or without any software?
http://www.devside.net/articles/windows/password
http://www.brandx.net/support/buildingwebsites/passwords.shtml
http://www.thesitewizard.com/apache/password-protect-directory.shtml
Implement User/Password-protected Directories for Apache Server

Hosting WebMatrix Page

What exactly do I need from a host for my webmatrix project to work? I know Scott Hanselman from Microsoft gave out a few nice host sites but I was just wondering for fun.
In order to publish to a host from WebMatrix using Web Deploy, the host needs to be in a compliant state. First of all, it has to run WebDeploy and the remote service WMSvc has to be in a desired state (enabled and started). Delegation rules have to be set up, so that the user has permissions and the right scope to deploy various components like IIS application, database, ACLs, etc. In order to check whether a host is WebMatrix-friendly, ServerValidator tool can be used (see the article for a full list of host requirements).
If you want to publish to a host though FTP, all you need to ensure is that FTP publishing is enabled on the host.
Hope this helps.
You can use any .Net 4.0 host, but you'll need to copy a bunch of DLL files to yuor bin folder.
The exact files required depend on what libraries your site uses.
At a minimum, you'll probably need
Microsoft.Web.Infrastructure.dll
Microsoft.Web.Helpers.dll
System.Web.Helpers.dll
System.Web.Razor.dll
System.Web.WebPages.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.Razor.dll
WebMatrix.Data.dll
WebMatrix.WebData.dll
These can be found in Program Files\Microsoft ASP.Net.
If it still doesn't work, copy any additional files from FileNotFound errors.
To publish your website from WebMatrix - your hosting provider must support one of the two publishing technologies - FTP and/or WebDeploy.
In case of FTP, you would need to manually enter the following ftp settings: FTP Server, username, password and destination url. Optionally you can also specify the site path
In case of WebDeploy, you could just get the publishsettings file for your host and import the settings. Else, you can also manually enter these settings.

Acessing Shared folder on server through local iis with xp OS

The scenario is as follows.
I am working on local XP machine. My resource folders like App_Themes, wanted to place on a servers shared location. I am setting up my asp.net site as default in IIS.
Any thoughts?
Let me know if you have any queries.
You need to enable Identity Impersonation in your web.config and then set up local IIS to use a (domain) account that has rights to the server's share.

Resources