LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-08-2007, 05:13 PM   #1
javier_ccs
Member
 
Registered: Apr 2005
Location: Milton Keynes
Distribution: ubuntu 12.10
Posts: 90

Rep: Reputation: 15
password encription in php


Hello,

i have a php appl that connects to a mysql db server, of curse i have to include the user and passwd, so far i have done it clear text...

i would like to know how can i encript that user & passwd so nobody can see it if doing a cat, more or vi...

i cant change the permission on the .php
 
Old 03-09-2007, 03:02 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
You can put the password in its own file and place that file in a directory that only the server has access to and don't allow directory browsing.
 
Old 03-09-2007, 06:38 AM   #3
javier_ccs
Member
 
Registered: Apr 2005
Location: Milton Keynes
Distribution: ubuntu 12.10
Posts: 90

Original Poster
Rep: Reputation: 15
thanx...

i have the web server running with user1 from the group users.

and the appl needs to be able to read that file anytime it must connect to the db, so i guess that user1 from the group users mut have read permissions on that file, and the user and passwd on the file stills are clear text...

i need to know if i can encript the passwd on the file...so the people that makes vi, cat or more.... doesnt see the passwd
 
Old 03-09-2007, 09:56 PM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
How would you unencrypt the file? Another password? if so where would you keep that other password?

The only way to make it secure is for the user to provide the password, but if the users who have access to an editor don't have rights to the file then you are on the right track.
 
Old 03-10-2007, 08:19 AM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
This might give you some ideas:

http://simonwillison.net/2003/Apr/20/javascriptMD5/

The principle is that you encrypt information on both sides (server and client), send over the encrypted information and do a compare at the server side.

jlinkels
 
Old 03-10-2007, 11:46 PM   #6
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Quote:
Originally Posted by jlinkels
The principle is that you encrypt information on both sides (server and client), send over the encrypted information and do a compare at the server side.
That's fine for when the client is logging into the server but the database password is normally different, and Mysql expects the password to be in plain text (as far as I am aware), remember MD5 is a one-way translation. But this idea works well with client to server authentication.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A C/C++ library for encription? nhydra Programming 2 05-22-2006 07:13 AM
Compare LDAP password with php crypt password coolamit78 Linux - Networking 1 01-30-2006 05:35 AM
Gaim Encription (Not Urgent!) Ian_Hawdon Linux - Software 6 02-16-2005 09:45 AM
File encription NSKL Linux - General 2 08-31-2004 09:55 AM
How can I change e-mail password(or linux account password) with php in website?? yusuf Programming 1 05-28-2004 09:39 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:46 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration