Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I remove "Index" in my /etc/apache2/sites-enabled/000-default file in order users not to be able to browse directories. I have sym link of a folder in /var/www/test (test is the symlinked folder). If I write in the address bar of the browser http://x.x.x.x/album/img_name.jgp I can see the picture, but I want contents not to be available.
Is that different from file browsing and how to disable it?
Distribution: Ubuntu 10.04 (used to be Red Hat 7.1, then Red Hat 9, then FC 2, FC 5, FC 6, FC 9 and Ubuntu 8.04)
Posts: 105
Rep:
If you add an index.html file to the directory that just says "File browsing not allowed" then anyone trying to browser that directory will get that message rather than a file list.
Ok. My first post is not clear. I have a sym link folder test in which
if I disable contents I can't get image from my web application(say simply my site) and
if I enable contents everyone can type address of the image and view it.
I didn't remove index.html. I remove Index option in the file I gave in my previous post (/etc/apache2/sites-enabled/000-default)
I want to access image through my site and no one can view it from the browser by entering it's address.
Your posts are not clear, and your final wish makes it even more confusing.
"I want to access image through my site and no one can view it from the browser by entering it's address" --- eeh, how would somebody be able to view that image? since the website, load the image of using an internal call to the address. (img statement)
Anyway, maybe this is what you ask for:
make a .htaccess file, and put this inside:
Options -Indexes
This disables directory listing on the webserver, for the directory where .htaccess is placed.
I'm assuming if you want to disable the contents listing in one directory you may want to disable it in all of them without having to add the index.html/.htaccess files in each.
Your file and directory configuration is different, but in my '/etc/apache2/vhosts.d/default_vhost.include' file I have a <Directory ... tag with an Options keyword. Set a -Indexes in this and everything may be cleared up with the issue we think you're bringing up.
As for your configuration I believe the Options keyword will be somewhere in the config files within the <Directory> tag.
Code:
<Directory "/var/www/localhost/htdocs">
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
Options -Indexes FollowSymLinks
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride All
# Controls who can get stuff from this server.
Order allow,deny
Allow from all
</Directory>
I want to access image through my site and no one can view it from the browser by entering it's address.
Either I don't understand your question, or you don't understand how the Internet works. If I understand correctly, you want it so nobody can do right click==>view image and save it from there. If so, how do you expect users to get it at all?
My posts are confusing because I am asking for option that I don't know it exists. I will try again.
I make a pesonal site with photos on my family and my friends, but I want everyone to login in order to see pictures. I have created start page, login page, image view page, etc. To be more clear I will give you the exact address http://xx.xx.xxx.xx/kodeimage
This is the login screen. I have symlinked folder in /var/www/kodeimage/album
Code:
ls -l album
lrwxrwxrwx 1 root root 27 2010-07-29 10:14 album -> /home/kode/7pictures/album/
I would recommend using Apache mod_auth authentication. You would have to replace your current login, but it would work for you. You can restrict the directory contents from being displayed unless the user has already logged in. With mod_auth you would not have to keep track of user's sessions either, Apache/your browser would take care of all of this. Take a look at http://httpd.apache.org/docs/2.0/howto/auth.html if this is something that you would want to implement.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.