Skip to content

Commit

Permalink
also add locked users to the passwd file for quota not to rage :P thx…
Browse files Browse the repository at this point in the history
… J-BBB

Signed-off-by: Michael Kaufmann (d00p) <[email protected]>
  • Loading branch information
d00p committed Dec 27, 2017
1 parent 148b2fc commit 57277eb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/classes/class.Extrausers.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static function generateFiles(&$cronlog)
{
// passwd
$passwd = '/var/lib/extrausers/passwd';
$sql = "SELECT username,'x' as password,uid,gid,'Froxlor User' as comment,homedir,shell FROM ftp_users WHERE login_enabled = 'Y' ORDER BY uid ASC";
$sql = "SELECT username,'x' as password,uid,gid,'Froxlor User' as comment,homedir,shell, login_enabled FROM ftp_users ORDER BY uid ASC";
self::_generateFile($passwd, $sql, $cronlog);

// group
Expand All @@ -39,7 +39,6 @@ public static function generateFiles(&$cronlog)
@chmod('/var/lib/extrausers/passwd', 0644);
@chmod('/var/lib/extrausers/group', 0644);
@chmod('/var/lib/extrausers/shadow', 0640);

}

private static function _generateFile($file, $query, &$cronlog)
Expand All @@ -59,6 +58,11 @@ private static function _generateFile($file, $query, &$cronlog)
while ($u = $data_sel_stmt->fetch(PDO::FETCH_ASSOC)) {
switch ($type) {
case 'passwd':
if ($u['login_enabled'] != 'Y') {
$u['password'] = '*';
$u['shell'] = '/bin/false';
$u['comment'] = 'Locked Froxlor User';
}
$line = $u['username'] . ':' . $u['password'] . ':' . $u['uid'] . ':' . $u['gid'] . ':' . $u['comment'] . ':' . $u['homedir'] . ':' . $u['shell'] . PHP_EOL;
break;
case 'group':
Expand Down

0 comments on commit 57277eb

Please sign in to comment.