Sponsored Content
Top Forums Web Development Apache2 does not display files inside directory Post 303038889 by baris35 on Monday 16th of September 2019 02:04:39 PM
Old 09-16-2019
Apache2 does not display files inside directory

Hello,
I have been running Ubuntu14.04 + apache2.
000-default.conf:
Code:
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        <Directory "/~boris/A">
        AuthType Basic
        AuthName "Authentication Required"
            AuthUserFile "/etc/apache2/.webroot"
            Require valid-user
          </Directory>

        <Directory "/~boris/B">
        AuthType Basic
        AuthName "Authentication Required"
            AuthUserFile "/etc/apache2/.webroot"
            Require valid-user
          </Directory>

</VirtualHost>

In Chrome, when I paste the url, it shows all files inside directory A.
urlA:
Code:
http://public_ip/~boris/A

It shows all files inside directory A.

urlB:
Code:
http://public_ip/~boris/B

url of directory B downloads html file.

Is there a limitation that would causing the issue or am I wrong with this conf file.
Or should I make it like:
Code:
        <Directory1 "/~boris/A">
        <Directory2 "/~boris/B">

Thank you
Boris
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to see directory and the files inside it.

Hi Expert, How can i able to see the directory and the files inside the directories. Is it possible, please suggest. Thanks shaan (4 Replies)
Discussion started by: shaan_dmp
4 Replies

2. Shell Programming and Scripting

files of size 0 need to be deleted inside a directory

Hiiii, I have written a script which takes backup of some log files. let say the backuplocation is --- /abc/backuplocation -rw-r--r-- 1 webmut2 spgroup 0 Jan 27 02:41 ansrpt23994.log -rw-r--r-- 1 webmut2 spgroup 0 Jan 27 02:41 ansrpt3601.log -rw-r--r-- 1... (2 Replies)
Discussion started by: namishtiwari
2 Replies

3. UNIX for Dummies Questions & Answers

searching files inside directory

hey, i need to use grep to search a bunch of header files inside a directory to return which file i can find the function i'm searching for in. how do i use wild cards to search through the files? i can only figure out how to search inside the directory, not inside the files that are in the... (4 Replies)
Discussion started by: kylethesir
4 Replies

4. UNIX for Dummies Questions & Answers

Find files and display only directory list containing those files

I have a directory (and many sub dirs beneath) on AIX system, containing thousands of file. I'm looking to get a list of all directory containing "*.pdf" file. I know basic syntax of find command, but it gives me list of all pdf files, which numbers in thousands. All I need to know is, which... (4 Replies)
Discussion started by: r7p
4 Replies

5. Shell Programming and Scripting

Find files inside the parent directory only

Hi All, The following find command lists the files which are 45 minutes older. But it searches for the sub directories also. $ find . -type f -mmin +45 -print ./hello.txt ./test/hi.txt ./temp/now.txt ls hello.txt test temp How can i modify the find command in such way that it finds... (4 Replies)
Discussion started by: Tuxidow
4 Replies

6. Shell Programming and Scripting

gzip files inside directory

Hello folks I hope every one is fine. I need to ask one question. I have directory /xx/abcd/data/ inside that data there are files like 11.txt 23.txt 12.txt *.txt i want that i will do compress each txt file inside that directory /xx/abcd/data/. But it will not gzip data... (1 Reply)
Discussion started by: learnbash
1 Replies

7. UNIX for Dummies Questions & Answers

Zip files inside the directory, but not the directory itself

Hi, Im facing a problem that im stucked, I have the following structure: thales@pereirtc-vbox:/home/VfARM$ ls code config doc lib manifest.bak manifest.rel manifest.v3 ns pub if i try to execute zip -q -o arm.zip VfARM/* it will create a zip file with the folder VfARM.... (2 Replies)
Discussion started by: Thales.Claro
2 Replies

8. Shell Programming and Scripting

remove a whole directory tree WITH files inside?

Assume I want to remove a whole directory tree beginning with /foo/bar/ The directory or sub-directories may contain files. The top directory /foo/bar/ itself should not be deleted. rm -f- r /foo/bar does not work because it requires a directory tree without files. How does it work... (3 Replies)
Discussion started by: pstein
3 Replies

9. Shell Programming and Scripting

How to grep all the files inside the directory and Sub directory

Hi, I have used the command cat * | grep -r <<String>> * It returns: cat : JAN : is directory *********************** ********************* My directory structure: log - JAN -catalina.out -FEB -catalina.out -MARCH ... (11 Replies)
Discussion started by: nanthagopal
11 Replies

10. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies
AuthenHook(3pm) 					User Contributed Perl Documentation					   AuthenHook(3pm)

NAME
Apache::AuthenHook - Perl API for Apache 2.1 authentication SYNOPSIS
PerlLoadModule Apache::AuthenHook PerlModule My::OtherProvider <Location /digest> Require valid-user AuthType Digest AuthName realm1 AuthDigestProvider My::DigestProvider file My::OtherProvider::digest AuthUserFile realm1 </Location> <Location /basic> Require valid-user AuthType Basic AuthName foorealm AuthBasicProvider My::OtherProvider::basic file My::BasicProvider AuthUserFile realm1 </Location> DESCRIPTION
Apache::AuthenHook offers access to the 2.1 Apache authentication API in Perl. This is different than the authentication API from Apache 1.3 or even Apache 2.0, but in its differences lies strength. For a full description of how authentication works in 2.1, see http://www.serverwatch.com/tutorials/article.php/2202671 Basically, the difference between 2.0 and 2.1 is that authentication is now delegated to providers, and each provider has a specific purpose. For instance, mod_authn_file covers gleaning the password from an .htpasswd or .htdigest file, while mod_auth_basic covers the Basic dialogue between the client and server, regardless of the source of the password. The best part of all this (to me) is that Digest authentication is also delegated out - mod_auth_digest now handles all the intricacies of Digest authentication (including the elusive MSIE support) which means you don't need to worry about them (and neither do I). All that Digest authentication requires is *some* authentication provider to provide user credentials - this can be via mod_authn_file or another mechanism of your choosing. Apache::AuthenHook registers and coordinates the use of Perl handlers as authentication providers. How does this affect you? Read on... EXAMPLE
Say you want to enable Digest authentication in your Apache 2.1 server... PerlLoadModule Apache::AuthenHook <Location /digest> Require valid-user AuthType Digest AuthName realm1 AuthDigestProvider My::DigestProvider file AuthUserFile realm1 </Location> This configuration means that My::DigestProvider will be responsible for providing user credentials for requests to /digest. if My::DigestProvider finds a suitable user, mod_auth_digest will verify those credentials and take care of setting all the proper headers, set the proper HTTP response status, and so on. If My::DigestProvider cannot find a matching user it can decide what to do next - either pass the user to the next provider (in this case the default file provider, which will use the flat file "realm1") or decide that no user means no access. Here is a simple My::DigestProvider use Apache2::Const -compile => qw(OK DECLINED HTTP_UNAUTHORIZED); sub handler { my ($r, $user, $realm, $hash) = @_; # user1 at realm1 is found - pass to mod_auth_digest if ($user eq 'user1' && $realm eq 'realm1') { $$hash = 'eee52b97527306e9e8c4613b7fa800eb'; return Apache2::Const::OK; } # user2 is denied outright if ($user eq 'user2' && $realm eq 'realm1') { return Apache2::Const::HTTP_UNAUTHORIZED; } # all others are passed along to the next provider return Apache2::Const::DECLINED; } isn't that easy? the only thing that is a bit tricky here is $$hash. the fourth argument passed to your handler, $hash, is a reference to to a simple scalar that needs to be populated with the MD5 hash of the user:realm:password combination you determine for the incoming user. this may seem a bit strange, but it is actually exactly how things work over in Apache C land, so I guess that makes it ok. as you can see, returning OK means "user found" and requires that $$hash be populated - mod_auth_digest will take care of determining whether the hash matches the incoming Digest criteria. returning HTTP_UNAUTHORIZED (which is the same as the former and still available AUTH_REQUIRED constant) means "no access." returning DECLINED means "some other provider can try." The steps are remarkably similar for Basic authentication, first <Location /basic> Require valid-user AuthType Basic AuthName foorealm AuthBasicProvider My::BasicProvider file AuthUserFile realm1 </Location> then use Apache2::Const -compile => qw(OK DECLINED HTTP_UNAUTHORIZED); sub handler { my ($r, $user, $password) = @_; # user1/basic1 is ok if ($user eq 'user1' && $password eq 'basic1') { return Apache2::Const::OK; } # user2 is denied outright if ($user eq 'user2') { return Apache2::Const::HTTP_UNAUTHORIZED; } # all others are passed along to the next provider return Apache2::Const::DECLINED; } In the case of Basic authentication, the return codes mean essentially the same thing. The one exception is that OK means that you have checked the user against the password and have found that they match (as opposed to with Digest, where the actual verification is not done by you). These explanations should be enough to get you going - see the files in the test suite for more examples. NOTES
This has been tested under the prefork MPM only, using mostly Perl 5.9.0 (as well as some 5.8.0). It will not work under threaded MPMs - soon, just not yet. FEATURES
/BUGS This is very much so alphaware, so beware - bugs may lurk in unexpected places. there is one bug that is outside of my control, though, and concerns MSIE and Digest authentication for URIs that include query strings. see http://httpd.apache.org/docs-2.0/mod/mod_auth_digest.html one workaround for this issue is is to use POST instead of GET for your forms. A limitation of this interface is that you can't use Perl providers that are not at least two levels deep - the criterion for registering a Perl provider is a simple check for a double-colon. for example, My::Provider will work while Provider won't (although Provider::handler will). anyway, single level handlers are rare, so fixing it would be a lot of trouble for little benefit. AUTHOR
Geoffrey Young <geoff@modperlcookbook.org> COPYRIGHT
Copyright (c) 2003, Geoffrey Young All rights reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. perl v5.14.2 2005-04-12 AuthenHook(3pm)
All times are GMT -4. The time now is 09:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy