Solved

.passwd to .htpasswd

Posted on 1997-05-30
3
1,016 Views
Last Modified: 2013-12-25
Can I convert /etc/.passwd to .htpasswd ?
In /etc/.passwd the password is not same with the .htpasswd.
Now I went protect my web home page .
just user who is the user in the linux can acces those files.
What can I write it ?

Thanks.
0
Comment
Question by:louisju
3 Comments
 

Accepted Solution

by:
walterk earned 10 total points
ID: 1828133
Hi,

Basically your .htaccess file is a pointer to the actual password file.

it looks something like this...
AuthUserFile passwords
AuthGroupFile /dev/null
AuthName Need Authentication
AuthType Basic

<Limit GET>
require valid-user
</Limit>

Now you have to create a file called passwords in your www-directory. Note, this can be very much a security breach as local users might have access to it (once they get in) The passwords file should also be readable by the web-server.

I assume you don't have a shadow password file and that your passwords are encrypted in the /etc/passwd file. The passwords file for the www-server is in the following format
<username>:<encrypted password>

Now you can convert your /etc/password to passwords with the following shell command.

cut -f 1,2 -d : /etc/passwd >passwords

You can automate this in a cron-job or on a script when a user gets added/removed. Don't forget to change the rights to the www-server rights.

Hope it helps

Warmest Regards
Walter
0
 

Author Comment

by:louisju
ID: 1828134
Thank you very much.
0
 

Expert Comment

by:tstang
ID: 1828135
Please be aware however that anyone with local access to that Linux box and access to perl can http packet sniff the passwords and receive perfectly decrypted usernames and passwords.

My suggestion is to at least run this with a second daemon on a different port. That way users are less likely to get it the first time.

0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question