also add locked users to the passwd file for quota not to rage :P thx J-BBB
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -21,7 +21,7 @@ class Extrausers
|
|||||||
{
|
{
|
||||||
// passwd
|
// passwd
|
||||||
$passwd = '/var/lib/extrausers/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);
|
self::_generateFile($passwd, $sql, $cronlog);
|
||||||
|
|
||||||
// group
|
// group
|
||||||
@@ -39,7 +39,6 @@ class Extrausers
|
|||||||
@chmod('/var/lib/extrausers/passwd', 0644);
|
@chmod('/var/lib/extrausers/passwd', 0644);
|
||||||
@chmod('/var/lib/extrausers/group', 0644);
|
@chmod('/var/lib/extrausers/group', 0644);
|
||||||
@chmod('/var/lib/extrausers/shadow', 0640);
|
@chmod('/var/lib/extrausers/shadow', 0640);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function _generateFile($file, $query, &$cronlog)
|
private static function _generateFile($file, $query, &$cronlog)
|
||||||
@@ -59,6 +58,11 @@ class Extrausers
|
|||||||
while ($u = $data_sel_stmt->fetch(PDO::FETCH_ASSOC)) {
|
while ($u = $data_sel_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'passwd':
|
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;
|
$line = $u['username'] . ':' . $u['password'] . ':' . $u['uid'] . ':' . $u['gid'] . ':' . $u['comment'] . ':' . $u['homedir'] . ':' . $u['shell'] . PHP_EOL;
|
||||||
break;
|
break;
|
||||||
case 'group':
|
case 'group':
|
||||||
|
|||||||
Reference in New Issue
Block a user