Sponsored Content
Top Forums Web Development .htaccess allow at directory level Post 302738083 by molwiko on Friday 30th of November 2012 10:19:40 AM
Old 11-30-2012
Wrench .htaccess allow at directory level

Hi Guys

I have a web a site at the following directory
/var/www/
the website is containing a lot of sub directories.
/var/www/mywebsite/folder1
/var/www/mywebsite/folder2
/var/www/mywebsite/folder3
I would like to block all the website expect one user ex: user1 password1
who can see everything and another user who can see only folder2 ex: user2 password1

Code:
AuthType Basic
AuthName htaccess
AuthUserFile /var/www/.secret
AuthGroupFile /dev/null
#<Limit GET POST>
#order deny,allow
#deny from all
#require user Loylogic
#require user Ates
#</Limit>
require user user1
SetEnvIf Request_URI "(/var/www/mywebsite)$" allow
Order allow,deny
Allow from env=allow
Satisfy any
require user user2
SetEnvIf Request_URI "(/var/www/mywebsite/folder1)$" allow
Order allow,deny
Allow from env=allow
Satisfy any

the issue this code doesn't work can you please help to sort to this our thanks

Last edited by Corona688; 11-30-2012 at 11:30 AM..
 

9 More Discussions You Might Find Interesting

1. Cybersecurity

htaccess

Something is wrong. I do everything right make the .htaccess file and stuff, but when I try the htpasswd command it says command not found. I use Putty SSH client and I think server is running RedHat 7.1 with Apache some version. HELP!!! (1 Reply)
Discussion started by: _hp_
1 Replies

2. UNIX for Advanced & Expert Users

MV files from one directory structure(multiple level) to other directory structure

Hi, I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub folder is source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (4 Replies)
Discussion started by: srmadab
4 Replies

3. Shell Programming and Scripting

How to exclude top level directory with find?

I'm using bash on cygwin/windows. I'm trying to use find and exclude the directory /cygdrive/c/System\ Volume\ Information. When I try to use the command below I get the error "rm: cannot remove `/cygdrive/c/System Volume Information': Is a directory. Can someone tell me what I am doing... (3 Replies)
Discussion started by: siegfried
3 Replies

4. Solaris

Difference between run level & init level

what are the major Difference Between run level & init level (2 Replies)
Discussion started by: rajaramrnb
2 Replies

5. Shell Programming and Scripting

How to parse filename and one level up directory name?

Hello Experts, I need little help with parsing. I want to parse filename and one level up directory name. sample $1 will consists of /home/username/ABC1/rstfiles4.log /home/username/ABC4/rstfiles2.log /home/username/EDC7/rstfiles23.log /home/username/EDC6/rstfiles55.log... (8 Replies)
Discussion started by: Shirisha
8 Replies

6. UNIX for Dummies Questions & Answers

Redirect with htaccess to upper level folder, how to?

Hello, Well I have a web with a very bad structure (a vBulletin forum) and I want it redirected to a newer folder in the same server but with a upper level folder. Current structure is: https://www.unix.com/vbulletin/upload/index.php And I want it to be:... (0 Replies)
Discussion started by: Rafaweb
0 Replies

7. Shell Programming and Scripting

How to get top level parent directory

Hi All, I have a directory like this: /u01/app/oracle/11gSE1/11gR203 How do i get the top level directory /u01 from this? Tried dirname and basename but dint help. I can this using echo $ORACLE_HOME | awk -F"/" '{print "/"$2}'. But I am trying to find out if there is a better way of doing it... (4 Replies)
Discussion started by: nilayasundar
4 Replies

8. Red Hat

SSL certificate generation on OS level or application level

We have a RHEL 5.8 server at the production level and we have a Java application on this server. I know of the SSL certificate generation at the OS (RHEL) level but it is implemented on the Java application by our development team using the Java keytool. My doubt is that is the SSL generation can... (3 Replies)
Discussion started by: RHCE
3 Replies

9. UNIX for Beginners Questions & Answers

Move all files one directory level up

I want to move all the files in a given directory up one level. For example: Dir1 Subdir1 I want to move all the files in Subdir1 up to Dir1 (then I want to ultimately delete Subdir1) Thanks, Ted (10 Replies)
Discussion started by: ftrobaugh
10 Replies
GIT-HTTP-BACKEND(1)						    Git Manual						       GIT-HTTP-BACKEND(1)

NAME
git-http-backend - Server side implementation of Git over HTTP SYNOPSIS
git http-backend DESCRIPTION
A simple CGI program to serve the contents of a Git repository to Git clients accessing the repository over http:// and https:// protocols. The program supports clients fetching using both the smart HTTP protocol and the backwards-compatible dumb HTTP protocol, as well as clients pushing using the smart HTTP protocol. It verifies that the directory has the magic file "git-daemon-export-ok", and it will refuse to export any git directory that hasn't explicitly been marked for export this way (unless the GIT_HTTP_EXPORT_ALL environmental variable is set). By default, only the upload-pack service is enabled, which serves git fetch-pack and git ls-remote clients, which are invoked from git fetch, git pull, and git clone. If the client is authenticated, the receive-pack service is enabled, which serves git send-pack clients, which is invoked from git push. SERVICES
These services can be enabled/disabled using the per-repository configuration file: http.getanyfile This serves Git clients older than version 1.6.6 that are unable to use the upload pack service. When enabled, clients are able to read any file within the repository, including objects that are no longer reachable from a branch but are still present. It is enabled by default, but a repository can disable it by setting this configuration item to false. http.uploadpack This serves git fetch-pack and git ls-remote clients. It is enabled by default, but a repository can disable it by setting this configuration item to false. http.receivepack This serves git send-pack clients, allowing push. It is disabled by default for anonymous users, and enabled by default for users authenticated by the web server. It can be disabled by setting this item to false, or enabled for all users, including anonymous users, by setting it to true. URL TRANSLATION
To determine the location of the repository on disk, git http-backend concatenates the environment variables PATH_INFO, which is set automatically by the web server, and GIT_PROJECT_ROOT, which must be set manually in the web server configuration. If GIT_PROJECT_ROOT is not set, git http-backend reads PATH_TRANSLATED, which is also set automatically by the web server. EXAMPLES
All of the following examples map http://$hostname/git/foo/bar.git to /var/www/git/foo/bar.git. Apache 2.x Ensure mod_cgi, mod_alias, and mod_env are enabled, set GIT_PROJECT_ROOT (or DocumentRoot) appropriately, and create a ScriptAlias to the CGI: SetEnv GIT_PROJECT_ROOT /var/www/git SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ To enable anonymous read access but authenticated write access, require authorization with a LocationMatch directive: <LocationMatch "^/git/.*/git-receive-pack$"> AuthType Basic AuthName "Git Access" Require group committers ... </LocationMatch> To require authentication for both reads and writes, use a Location directive around the repository, or one of its parent directories: <Location /git/private> AuthType Basic AuthName "Private Git Access" Require group committers ... </Location> To serve gitweb at the same url, use a ScriptAliasMatch to only those URLs that git http-backend can handle, and forward the rest to gitweb: ScriptAliasMatch "(?x)^/git/(.*/(HEAD | info/refs | objects/(info/[^/]+ | [0-9a-f]{2}/[0-9a-f]{38} | pack/pack-[0-9a-f]{40}.(pack|idx)) | git-(upload|receive)-pack))$" /usr/libexec/git-core/git-http-backend/$1 ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/ To serve multiple repositories from different gitnamespaces(7) in a single repository: SetEnvIf Request_URI "^/git/([^/]*)" GIT_NAMESPACE=$1 ScriptAliasMatch ^/git/[^/]*(.*) /usr/libexec/git-core/git-http-backend/storage.git$1 Accelerated static Apache 2.x Similar to the above, but Apache can be used to return static files that are stored on disk. On many systems this may be more efficient as Apache can ask the kernel to copy the file contents from the file system directly to the network: SetEnv GIT_PROJECT_ROOT /var/www/git AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/www/git/$1 AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/www/git/$1 ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ This can be combined with the gitweb configuration: SetEnv GIT_PROJECT_ROOT /var/www/git AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/www/git/$1 AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/www/git/$1 ScriptAliasMatch "(?x)^/git/(.*/(HEAD | info/refs | objects/info/[^/]+ | git-(upload|receive)-pack))$" /usr/libexec/git-core/git-http-backend/$1 ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/ ENVIRONMENT
git http-backend relies upon the CGI environment variables set by the invoking web server, including: o PATH_INFO (if GIT_PROJECT_ROOT is set, otherwise PATH_TRANSLATED) o REMOTE_USER o REMOTE_ADDR o CONTENT_TYPE o QUERY_STRING o REQUEST_METHOD The GIT_HTTP_EXPORT_ALL environmental variable may be passed to git-http-backend to bypass the check for the "git-daemon-export-ok" file in each repository before allowing export of that repository. The backend process sets GIT_COMMITTER_NAME to $REMOTE_USER and GIT_COMMITTER_EMAIL to ${REMOTE_USER}@http.${REMOTE_ADDR}, ensuring that any reflogs created by git-receive-pack contain some identifying information of the remote user who performed the push. All CGI environment variables are available to each of the hooks invoked by the git-receive-pack. AUTHOR
Written by Shawn O. Pearce <spearce@spearce.org[1]>. DOCUMENTATION
Documentation by Shawn O. Pearce <spearce@spearce.org[1]>. GIT
Part of the git(1) suite NOTES
1. spearce@spearce.org mailto:spearce@spearce.org Git 1.7.10.4 11/24/2012 GIT-HTTP-BACKEND(1)
All times are GMT -4. The time now is 06:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy