G Web Server Examples Title

Access Control of Directories

Sometimes you need to have control over who has access to certain directories, documents or CGI VIs. You can limit access to directories based on the browser's internet address or the referring document (the page from which the document was reached). You can also require a user name and password in order to display an image.

Access for directories can be specified in the global access configuration file, internet/http/conf/access.cfg, which you can edit by hand or with the HTTP Access Configuration VI. You can also protect individual directories with a directory access file. The different directives for the configuration file are described in the user manual.

You can look at the Access Control of Panel Images example to see how the global access control file is used (instead of the <Panel> directive you will use <Directory>, and instead of SNAPSHOT and MONITOR, you can use GET and PUT).



The folowing documents are in directories that use the pwd.txt and grp.txt files in the internet/home/examples/access/ directory. These files are specified with this htaccess.txt file.

The group file consists of the following groups: The passwords for these users are their last name, i.e
Group Members
beatles george, john, paul, and ringo
composers antonin, bedrich, bela, franz, frederic, gabriel, igor, leonard, richard, and wolfgang
actors humphrey, cary, hugh, tom, robert, gerard, roger, marcello, and anthony
british anthony, george, hugh, john, paul, ringo, roger
User Password
john lennon
ringo starr
antonin dvorak
leonard bernstein
wolfgang mozart
anthony hopkins
cary grant
gerard depardieu



The following example is a document in a directory protected by this htaccess.txt file. In order to view it, you have to supply any user name found in the user file.
User: bela
Password: bartok
User: roger
Password: moore
User: gerard
Password: depardieu



The following example is a document in a directory protected by this htaccess.txt file. In order to view it, you have to supply a user name and passord for one of the members in the beatles group.
User: john
Password: lennon
User: paul
Password: mccarntey
User: ringo
Password: starr



The following example is a document in a directory protected by this htaccess.txt file. In order to view it, you have to supply a user name and passord for one of the members in the actors group or for the users richard or wolfgang.
User: cary
Password: grant
User: richard
Password: wagner
User: wolfgang
Password: mozart


The following example is a document in a directory protected by this htaccess.txt file. In order to view it, you have to supply a user name and passord for one of the members in the composers or british group.
User: john
Password: lennon
User: bedrich
Password: smetana
User: anthony
Password: hopkins



© National Instruments