Operating System - HP-UX
1748214 Members
3303 Online
108759 Solutions
New Discussion

Are there any solutions for this mission?

 
SOLVED
Go to solution
Fragon
Trusted Contributor

Are there any solutions for this mission?

I have a directory mounted as /share and under "/share" there are 3 sub-dirs named "/share/super","/share/limit"and"/share/public".
All users can only access these directories by web.
/share/super will store the original files such as EXCEL/Word files and /share/limit and /share/public will store some read-only files such as PDF files.I want to:
1. Super-users can access(list,get and put) all these directories.
2. Limit-users can access (list and get)/share/limit & /share/public directories.
3. Normal-users can only access(list and get) /share/public directory.

Can anyone tell how to achieve this?
Thanks in advance!
1 REPLY 1
Yogeeraj_1
Honored Contributor
Solution

Re: Are there any solutions for this mission?

Hi,

If you are using Apache as your web server, you can looking into htpasswd.

Below a quote from man:

htpasswd is used to create and update the flat-files used to
store usernames and password for basic authentication of
HTTP users. If htpasswd cannot access a file, such as not
being able to write to the output file or not being able to
read the file in order to update it, it returns an error
status and makes no changes.

Resources available from the httpd Apache web server can be
restricted to just the users listed in the files created by
htpasswd. This program can only manage usernames and pass-
words stored in a flat-file. It can encrypt and display
password information for use in other types of data stores,
though.

htpasswd encrypts passwords using either a version of MD5
modified for Apache, or the system's crypt() routine. Files
managed by htpasswd may contain both types of passwords;
some user records may have MD5-encrypted passwords while
others in the same file may have passwords encrypted with
crypt().




To generate the password, you can using the following URL:
http://www.xs4all.nl/~remcovz/htpasswd.html

or use: htpasswd [-c] .htpasswd {username}


A .htaccess file must be created in the directory that the user wants to secure. (Multiple directories can have .htaccess files, but there can only be one .htaccess file per directory.)

Basically, these are the steps:

1. While in the directory you want to secure, edit a file called .htaccess using your favorite text editor.

2. The .htaccess file contains 2 sections:

a.The first section of .htaccess must contain 4 lines:
AuthUserFile {path to .htpasswd file}
AuthGroupFile {path to .htgroup file}
AuthName {title for dialog box}
AuthType Basic

b. The second section is a bit trickier. It will contain 3 parts:

{access instruction to be executed}

3. Unix file permissions for the ".htaccess" file must be set so that everyone (ie. owner,group, and other) has read permissions.



hope this helps
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)