Solved

.passwd to .htpasswd

Posted on 1997-05-30
3
1,023 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

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…
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 …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
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…

729 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