The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Auto copy for files from folder to folder upon instant writing Bashar UNIX for Advanced & Expert Users 2 08-21-2008 03:44 PM
How to display contents of folder when 'cd' is used mumashankar UNIX for Dummies Questions & Answers 3 03-06-2008 07:42 PM
Parse the .txt file for folder name and FTP to the corrsponding folder. MeganP Shell Programming and Scripting 3 07-03-2007 02:54 PM
display the files in a folder which are older than 1 hour vgs Shell Programming and Scripting 7 05-29-2007 03:05 PM
display the files in a folder which are older than 1 hour vgs UNIX for Dummies Questions & Answers 3 05-25-2007 09:46 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-08-2007
srinivasan_85 srinivasan_85 is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 28
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?

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..!!

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

Thanks
Srini
  #2 (permalink)  
Old 01-08-2007
BOFH BOFH is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 406
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 (permalink)  
Old 01-09-2007
srinivasan_85 srinivasan_85 is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 28
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) !

It is really difficult to express my problem verbally !

Thanks
Srini
  #4 (permalink)  
Old 01-09-2007
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,972
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. 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 (permalink)  
Old 01-10-2007
BOFH BOFH is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 406
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) !

It is really difficult to express my problem verbally !

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

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 (permalink)  
Old 01-10-2007
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
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 , 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 (permalink)  
Old 01-10-2007
BOFH BOFH is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 406
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 , 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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:24 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0