Logic behind display of .www folder ??


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Logic behind display of .www folder ??
# 1  
Old 01-08-2007
Logic behind display of .www folder ??

Hi frns,
I have a weird quest. I want to know the logic behind the display/rendering of the directory structure when there is no "index.htm" in the .www directory of the user. The requirement of this knowledge rooted from another requirement. Let me brief it.. I want to place a "index.htm" in my .www folder, which provides some info to the visitors (some links, pics, downloads), and finally it also should provide a link to the "directory structure" which would have been displayed in case the "index.htm" was absent ! I donno if this is possible. I dont want any CGI wich transform the ls to html. Is there a straight way around for this problem? Smilie

I told its 'weird' cuz, if the index.htm wasnt there, the default dir structure will be displayed.. Now since its there, it overrides the default behaviour, which i want to nullify when the user clicks on one of the links of index.htm. One can do this only if the intricacies of unix are known.. btw i am also baffled whether this listing of dir structure is done by unix or windows, cuz the browsers are run in windows environment only.. but windows displays unix dirs in a different way compared to win dirs..!! Smilie

Please tell me if you dont get the question... Smilie

Thanks
Srini
# 2  
Old 01-08-2007
Actually it's the web server's configuration that interprets this. Your server appears to display a directory if the default file isn't present (index.htm in this case). Mine's configured to not display the directory (you get a Forbidden error I believe).

One way would be to change the default document for your home directory so there isn't one, or that index.htm isn't one of them. Then when someone browses to your directory, they get a directory listing and they can click on the index.htm to get your index page. Plus you can force it to index.htm by giving out yoursite/index.htm. The httpd.conf file is generally owned by the web server process or by root so if you're not root, you'll need to get their ok to have it changed just for your directory.

Alternately, you can have an index.php file as one of the documents and have it just whip up a quick directory listing with some data at the top welcoming folks to your site. That assumes php is installed of course. Not sure if you can do that with perl (I use php for other things so php is available to me).

Carl
# 3  
Old 01-09-2007
Question Further Clarification wud be helpful

Hi,
Thank you for ur response. My problem is not related to webserver. Actually i am in an intranet, where in i have my own disk space of a shared network drive. In this case, i am the person who gives access to the .www dir of my home drive. Now I wanna put the index.htm in my .www dir, so that others type "http://www/~srini" to access my homepage. This home page is now the dir structure of my home directory. When i place index.htm in the .www dir, it will display the contents of index.htm. I just want to provide users a link on index.htm, which will lead them to the plain old dir structure display.
What you suggested is to rename index.htm to some other file say "random.htm", so that users would by default get the dir structure, from where they can click random.htm. But i just want to do the reverse !! I wanna make users click on a link on index.htm so that they would go back to the directory structure (which cannot be done thro a link to www/~srini, because it is overridden by the placing of index.htm) ! Smilie

It is really difficult to express my problem verbally ! Smilie

Thanks
Srini
# 4  
Old 01-09-2007
Quote:
Originally Posted by srinivasan_85
Hi,
Thank you for your response. My problem is not related to webserver. Actually I am in an intranet, where in I have my own disk space on a shared network drive.
Internet, intranet, still a web server. Smilie You won't get an http://... page, even on an intranet, without a web server answering the request when you try to load that page. All the advice given still applies.
# 5  
Old 01-10-2007
Quote:
Originally Posted by srinivasan_85
Hi,
Thank you for ur response. My problem is not related to webserver. Actually i am in an intranet, where in i have my own disk space of a shared network drive. In this case, i am the person who gives access to the .www dir of my home drive. Now I wanna put the index.htm in my .www dir, so that others type "http://www/~srini" to access my homepage. This home page is now the dir structure of my home directory. When i place index.htm in the .www dir, it will display the contents of index.htm. I just want to provide users a link on index.htm, which will lead them to the plain old dir structure display.
What you suggested is to rename index.htm to some other file say "random.htm", so that users would by default get the dir structure, from where they can click random.htm. But i just want to do the reverse !! I wanna make users click on a link on index.htm so that they would go back to the directory structure (which cannot be done thro a link to www/~srini, because it is overridden by the placing of index.htm) ! Smilie

It is really difficult to express my problem verbally ! Smilie

Thanks
Srini
I'm pretty sure I understood what you're asking. I have to deal with users on a day to day basis so interpreting requests is one of my skills Smilie

1. You have an HTTP accessible directory: http://www/~srini
2. When someone reaches that directory now, they get a directory list.
3. When you put index.htm into that directory, the browser loads index.htm
4. You'd like a link on your index.htm page to be able to direct the browser to http://www/~srini and present a directory listing.

One question would be, how to people get to your directory in the first place? Are you giving them the URL (via e-mail or verbally) or is it a link off a Student or Office Directory (for example). If it's either of those methods, my suggestion will still work.

1. Modify your individual directory configuration in the web server configuration file to exclude index.htm from the DirectoryIndex variable (for Apache).
2. Modify the Student/Office Directory listing to include index.htm and the listing now says:
Code:
<a href="http://www/~srini/index.htm">Srini's Home</a>

3. When you give out your home directory listing, make sure you include the trailing /index.htm in the URL.
4. In the index.htm, have a link that points to just your home directory:
Code:
<a href="http://www/~srini/">Directory Listing</a>

And that should take care of it.

If you want to eliminate a few steps or are unable to modify your DirectoryIndex variable, you can simply use an alternate html file (like random.htm). Just make the same changes to the Directory listing and the URLs you provide to friends.

Another option works if you have php or perl installed. I did a quick google search and found this:

http://www.evoluted.net/community/co...orylisting.php

With this, you can provide a very nice looking configurable directory listing through php. I haven't reviewed the code for vulnerabilities or anything so I'm not recommending that you use it, just providing it as an example of code that's already on the 'net and ready to use. (If you do decide to try it, make sure you go though the script and understand what the script is doing first so you don't leave your system open to attack.)

Oh, and there certainly is a web server on your system. If you
Code:
$ telnet [yourservername] 80

you might get a server signature string which will identify the server, assuming the admins haven't obfuscated it for security reasons (unlikely if they allow directory listings since that's generally considered a minor security issue). Type
Code:
GET / HTTP/1.0<enter><enter>

to exit out of the session.

Hope that helps.

Carl
# 6  
Old 01-10-2007
If you have access to the Apache config (or if you are allowed to use a .htaccess file), if your webserver is Apache, of course Smilie, you can set the HeaderName directive so that it points to the html file you want. Refer to Apache.org docs to learn how to use it.
mod_autoindex: http://httpd.apache.org/docs/2.0/mod...tml#headername
I think other versions support this directive.
# 7  
Old 01-10-2007
Quote:
Originally Posted by grial
If you have access to the Apache config (or if you are allowed to use a .htaccess file), if your webserver is Apache, of course Smilie, you can set the HeaderName directive so that it points to the html file you want. Refer to Apache.org docs to learn how to use it.
mod_autoindex: http://httpd.apache.org/docs/2.0/mod...tml#headername
I think other versions support this directive.
Yea but I believe what he wants to do is have people who go to his website automatically go to the index.htm file where they get the normal "Welcome to my home page" message but there's a link that will just show the directory. I don't think that's possible with what's normally installed. It can be kludged or you can create or search for a script that'll present the directory like the one I found.

Carl
 
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

chroot openssh access www folder

here is the setup<br/> sshd_config: <pre> Match User sftp ChrootDirectory /chroot/sftp </pre> I connect just fine to the folder <pre>/chroot/sftp</pre> However I cannot access the website developer folder due to it being outside the scope of the defined chrootdirectory... (2 Replies)
Discussion started by: dunpealslyr
2 Replies

2. UNIX for Dummies Questions & Answers

Permissions of the folder var/www

what should be the permissions of the folder var/www in my ubuntu ? I need it to be safe and at the same time I need ftp users to be able to edit it. I was wondering if I should create a group with all permissions and add ftp users to this group in unix. what's the standard way to do it ?... (4 Replies)
Discussion started by: aneuryzma
4 Replies

3. UNIX for Dummies Questions & Answers

How to display contents of folder when 'cd' is used

Hi, I am a new learner of Unix. I am currently working on a Solaris 8 machine. Earlier, when I use 'cd <folder name>' command, I am not only able to change the folder but also able to see the contents of the folder as if a 'ls -lt' command was executed. However, since a week, suddenly this... (3 Replies)
Discussion started by: mumashankar
3 Replies

4. Shell Programming and Scripting

display the files in a folder which are older than 1 hour

Hi, I have some files in a folder with different time stamps and I want to display the files which are older than 1 hour. i tried with find. need urgent help. (7 Replies)
Discussion started by: vgs
7 Replies

5. UNIX for Dummies Questions & Answers

display the files in a folder which are older than 1 hour

Hi, I have some files in a folder with different time stamps and I want to display the files which are older than 1 hour. i tried with find. need urgent help. (3 Replies)
Discussion started by: vgs
3 Replies
Login or Register to Ask a Question