LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-11-2021, 01:21 AM   #1
JSB
Member
 
Registered: Dec 2020
Posts: 102

Rep: Reputation: 22
How to put password in file safe?


Hello i have script and need automatuc password to enter.
script is execute trough user http.
I want to store password safe, not in plain in config file.

How can I do?

TIA

Last edited by JSB; 05-11-2021 at 01:23 AM.
 
Old 05-11-2021, 02:07 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7336Reputation: 7336Reputation: 7336Reputation: 7336Reputation: 7336Reputation: 7336Reputation: 7336Reputation: 7336Reputation: 7336Reputation: 7336Reputation: 7336
This is unclear (at least for me)
Quote:
Originally Posted by JSB View Post
script is execute trough user http.
Where do you need authentication? To connect to the http server, to execute something somewhere, or what?
Which language is it? What kind of environment is it?
 
Old 05-11-2021, 08:03 AM   #3
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,153

Rep: Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265
If you must store a password, then just store it in a plain text file with permission 0400 (r for user http, none for anyone else). There is no point in obfuscating the password; if the script can decode it then anyone can. Use expect to read $(cat privatedirectory/passwordfile) and enter the password. Don't use the same password anywhere else or for anything critical, as this is not very safe. Also don't do what sshpass does, which is to put the password in plain text on the command line, where anyone doing ps can see it.
 
1 members found this post helpful.
Old 05-11-2021, 02:00 PM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,736

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
apache auth is the recommended method to password pages or sections of a web site.
Access is configured in the config file or a .htaccess file.
https://httpd.apache.org/docs/current/howto/auth.html

The password(s) are stored in a file not in the web root, and are encrypted.
 
  


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
Unable to find Administrators password does not recognize my login password the only password I entered at setup of Linux scholarsgold Linux - Newbie 6 01-23-2018 03:58 PM
[SOLVED] Is it safe to not put break; if you have brackets? C++ tfnc99 Programming 2 03-08-2013 02:12 AM
Put Safe Mode Off Slackervaara Mandriva 4 08-19-2012 06:43 AM
Put each daily cron task in a separate script or put them all in one script? veeruk101 Linux - Newbie 4 10-19-2011 07:10 AM
Is it safe to put Trixbox on public IP? depam Linux - Software 1 12-14-2006 06:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:21 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