harryz
harryz

Reputation: 5280

How can I check if a user is disabled in PHP?

I'm writing a PHP program to list user information.

I want to check if a user in /etc/passwd is disabled, so I have to check if a specific user has password like * or ! in /etc/shadow file.

Here is the problem, my Apache server has no access to shadow file, and I think reading shadow file is not safe in any case.

Can anyone help me with this problem?

Upvotes: 1

Views: 114

Answers (2)

mansuetus
mansuetus

Reputation: 822

I/ Fetch the results with a root shell script run with cron.

for line in /etc/shadow store in /var/www/.../users.status.php
<?php die("do not open this file"); ?>
username:Active
username2:Inactive
...

II/ Make the php script that tests the created file with user submitted value...

Upvotes: 0

Mahmoud.Eskandari
Mahmoud.Eskandari

Reputation: 1478

/etc/passwd is Apache Folder and this folder is private...
You can't Access to it in most servers!
if user disabled on server ,he can't access to run php!

Upvotes: 1

Related Questions