Solved

.passwd to .htpasswd

Posted on 1997-05-30
3
1,004 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now