LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 03-15-2010, 01:02 AM   #1
newbie01.linux
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Rep: Reputation: 0
Scripting help/advise on hiding/masking username/password


Hi,

I currently have a UNIX script with a function that uses a username and password to connect to the database, retrieve some information and then exit.

At the moment, am getting the username and password from a hidden plain text file and permission set to -r--------, i.e. read only to who own the file.

The owner of the file is the same owner of the script. At the moment, am not too overly concern as the script works as it is but I want to know if anyone have a suggestion if there is any better way of achieving the same thing with some "form" of security, i.e., for example, masking the username/password.

Basically, I want to be able to mask or hide the username or password in some way. I've thought about encryting the password file, which is in plain text, using simple crypt command from which I retrieve the username and password but I need to decrypt it as well which is sort of similar to how it will be as it is now once it is decrypted.

Is there anyway that I can get a username and password in some gibberish format and then translating them into something usable which can be passed on the next command that requires the username/password.

Any advise or suggestion will be very much appreciated. Some kind of starting point to test with I supposed ...

Thanks in advance.
 
Old 03-15-2010, 09:18 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by newbie01.linux View Post
Hi,

I currently have a UNIX script with a function that uses a username and password to connect to the database, retrieve some information and then exit.

At the moment, am getting the username and password from a hidden plain text file and permission set to -r--------, i.e. read only to who own the file.

The owner of the file is the same owner of the script. At the moment, am not too overly concern as the script works as it is but I want to know if anyone have a suggestion if there is any better way of achieving the same thing with some "form" of security, i.e., for example, masking the username/password.

Basically, I want to be able to mask or hide the username or password in some way. I've thought about encryting the password file, which is in plain text, using simple crypt command from which I retrieve the username and password but I need to decrypt it as well which is sort of similar to how it will be as it is now once it is decrypted.

Is there anyway that I can get a username and password in some gibberish format and then translating them into something usable which can be passed on the next command that requires the username/password.

Any advise or suggestion will be very much appreciated. Some kind of starting point to test with I supposed ...

Thanks in advance.
Well, I'd never save user IDs/passwords in a clear text file, no matter what. Very simple to find a 'hidden' file, and compromise it.

In my software, I will use PGP and a strong cipher, to encrypt the license code, etc., and have my programs decrypt it, then look at what it spits out. If the key is missing, changed, etc., the programs don't run. You could do that for a shell-script as well. That'd be more secure, since you could prompt the user for the PGP decrypt key/password, and the file that's on the drive is pretty safe.

The best way to do it, in my opinion, would be to prompt for the user ID/password each time, and not save ANYTHING on the drive. Especially for a shell script. But I think that as long as you're using a shell script, or anything that's not compiled, it's going to be insecure. Since the shell script is basically clear-text, an extra line or two could be inserted easily, to write the passwords/ID's to another file, send them to someone via email, etc. Even if you encrypt it, they can easily see the variable that you're calling, and just burp it out somewhere else, rendering all the encryption pointless.
 
Old 03-15-2010, 09:29 AM   #3
RaelOM
Member
 
Registered: Dec 2004
Posts: 110

Rep: Reputation: 16
yea, check out pgp or gpg. This will do what you're looking for.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding smb mount password in fstab? Hashing? humbletech99 Linux - Networking 6 09-13-2021 10:19 AM
Hiding password in /boot/grub/menu.lst jdkaye Debian 4 05-04-2009 07:46 AM
Hiding password in Java command line program simon_w Programming 2 05-02-2005 06:01 AM
username/password sailu_mvn Programming 5 12-21-2004 03:21 AM
UserName and Password luis8460 Red Hat 0 07-08-2004 04:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:17 PM.

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