r/PHPhelp • u/Responsible-Remove67 • Jan 13 '25
Supreme password?
Is it a good thing to put a "master" password for logins in my website, a extremely long password that works on every account a password changed every hours/days? A password that is stored in a file deep in the server computer root
1
Upvotes
28
u/Valoneria Jan 13 '25
A master password is just a security breach that hasn't been exploited yet
6
u/colshrapnel Jan 13 '25
It doesn't seem anything usable.
If this password is being changed every hours/days, how do you suppose to know it when needed?
Besides, "A password that is stored in a file deep in the server computer root" is rather just fooling yourself. Once someone has access to your site, it takes seconds to find any files. Once someone don't - then just a regular password is enough.
I have a feeling that what you are looking for is a feature called impersonation, when admin can choose a user to log in under. That's standard functionality that can be found in many CMS of frameworks (via core or plugins)
6
u/[deleted] Jan 13 '25
Instead of having a master password for every account, a more sane way would be to do this as an admin feature. For example in you user list you can have a button to "Log in as..", when pressed it would setup your session as if the user was logged in. So if in the session you hold the id of the logged in user then it would populate that user id, so now you are logged in as that user without using any of their credentials.
2
u/martinbean Jan 13 '25
No. Because if that password is compromised then every account is then compromised.
1
u/Vroomped Jan 13 '25
No. However you deliver that password on the daily/hourly/etc is a security vulnerability, further people who have access to that password are liable for unwanted changes to accounts.
1
u/KaleRadiant6745 Jan 26 '25
What is the password for xxx
0
u/amarukhan Jan 13 '25
At the very least you should not store it in plain text. Use password_hash on the password and store the returned hash. When logging in, use password_verify to check if the entered password matches the hash.
So even if your file system is compromised, they can't just scan and see the actual password.
0
u/[deleted] Jan 13 '25
[deleted] — view deleted comment