LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-16-2002, 04:49 AM   #1
steve_c
LQ Newbie
 
Registered: Apr 2002
Posts: 12

Rep: Reputation: 0
htpasswd


Hi - I'm new here and would like to ask a couple of questions:

I have a list of 400 people and passwords on a spreadsheet - is there an easy way of transferring these to the htpasswd file?

Also - is there a way I can secure areas of my website using a mysql database of user ID's and Passwords? I have seen a php script and class but obviously this would not protect binary files in the area (as they wouldn't be parsed).

Any help greatly appreciated.

Thanks in advance,

Steve.
 
Old 04-16-2002, 06:33 AM   #2
Eternal
Member
 
Registered: Feb 2002
Location: Austria
Distribution: LFS based opon debian or course
Posts: 38

Rep: Reputation: 15
impossible, exel,word should use a XML standart encoding type, if so you could with sed'n awk but heh its microsoft

We dont live in a perfect world! Specialy not with m$ around. For ya php i see you draw conclusions befor being guru in it.

send a header to the doc and include("/out/of/httpd/directory"); also you could use php with htpasswd linked to a mysql db. Would need a little work but google is your friend (phpbuiler too).

Anyway i wont 1kg of sweeties last nigth, i have to run see ya!!
 
Old 04-16-2002, 06:41 AM   #3
steve_c
LQ Newbie
 
Registered: Apr 2002
Posts: 12

Original Poster
Rep: Reputation: 0
Has anyone got an answer to this that I can actually understand?
 
Old 04-16-2002, 08:15 AM   #4
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 46
I think what he was trying to say was that an excel sheet is a binary Microsoft format. To generate the passwd file you will need it in plain text.
One way to do this is to open the excel sheet and then use the save as to something like a comma seperated text file. You can then easily parse the file with a simple script and use it as input to create the passwd file.

For authentication using a database try reading the following for some more information:

http://httpd.apache.org/docs/howto/auth.html#database
 
Old 04-16-2002, 08:44 AM   #5
steve_c
LQ Newbie
 
Registered: Apr 2002
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks for the reply - I'm sure I can get round tosaving them as a text file

Would you be able to give me any pointers to a script that could parse this information to me?
 
Old 04-16-2002, 09:13 AM   #6
Eternal
Member
 
Registered: Feb 2002
Location: Austria
Distribution: LFS based opon debian or course
Posts: 38

Rep: Reputation: 15
From XML :


sed -e 's/<XMLFIELD>/INSERT INTO TABLE (ID,FIELD) VALUES ('\''NULL'\'','\''/g' |sed -e 's/<field>/'\'');/g' > output1

and you can get a Proper file full of sql queryes

Try top open the .exel with koffice or star, open office and save as "real format" and run a sed command.

Read this from my book heh our book a community one :

stream editor. Sed is a steam editor, it means that if you some really nice file talking about windows and you just realized that the file wasnt appropriat for windows and you want to transform it into linux you would simple issue :

sed 's/windows/linux/g' oldfile > newfile

Sed will "cat" the "oldfile" and replace all the "windows" by "linux" its very simple, it becomes very handy for coding and hacking other peoples code, here is an other example :

sed 's/copyright/CopyRights_Suck/g' index.php > index2.php

Thats would exchange all the copyright in index.php to CopyRights_Suck and make a new file named index2.php.
Sed is a very complicated tool to use and i would strongly suggest thats you read the manual (man sed).

In action :

geekland:/home/oliver# echo "foobar" > test
geekland:/home/oliver# sed 's/foobar/sed_works/g' test |more
sed_works
geekland:/home/oliver#

There is didnt send all the output (>) to a diferent file but i told it to print it in the terminal with "|more" so if the file to too long i can still read it all. The reason i did that was to be shour of what i was doing, mistype, problemes, faulty commands... can happen and i want sed to help me, not detroy my work.

(Im shure even you can understand that (flamebait!!) j/k )

Last edited by Eternal; 04-16-2002 at 09:15 AM.
 
Old 04-16-2002, 09:36 AM   #7
steve_c
LQ Newbie
 
Registered: Apr 2002
Posts: 12

Original Poster
Rep: Reputation: 0
I think I'll just input them manually - thanks all the same.


 
Old 04-16-2002, 09:36 AM   #8
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 46
Well if you get the excel file in the following format

name1;password1
name2;password2

Then something like the following script should work:

#!/bin/bash

for line in `cat textfiletoparse`
do
name=`echo $line | cut -f 1 -d ';'`
password=`echo $line | cut -f 2 -d ';'`

htpasswd -b passwordfile $name $password
done
 
Old 04-16-2002, 09:54 AM   #9
steve_c
LQ Newbie
 
Registered: Apr 2002
Posts: 12

Original Poster
Rep: Reputation: 0
Thats more like it

Thanks Mik.
 
Old 04-16-2002, 10:12 AM   #10
Eternal
Member
 
Registered: Feb 2002
Location: Austria
Distribution: LFS based opon debian or course
Posts: 38

Rep: Reputation: 15
Booooo ;( You prefer to copy past than learn? How crazy
 
Old 04-16-2002, 10:15 AM   #11
steve_c
LQ Newbie
 
Registered: Apr 2002
Posts: 12

Original Poster
Rep: Reputation: 0
Eternal - Only been using for about 3 weeks now - I started by trying to configure sendmail which nearly pushed me over the edge!

I'm sure that in a few weeks I'll come back to this forum and understand exactly what you said!

Cheers,

Steve.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess .htpasswd plisken Linux - General 5 05-21-2006 01:44 PM
htpasswd integra_twinz Linux - Newbie 10 11-01-2005 10:08 AM
.htpasswd failure knight01 Fedora 6 12-05-2004 03:11 PM
htpasswd problems!!!! elam Linux - Software 1 05-15-2004 03:09 AM
Help with .htpasswd and .htaccess MikeeX Linux - General 3 03-25-2003 10:41 AM


All times are GMT -5. The time now is 07:06 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration