Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion var/www/cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,36 @@
$reload[$account['instance']] = true;
//add and manage rights of system user
$shell = ENABLE_SHELL_ACCESS ? '/bin/bash' : '/usr/sbin/nologin';
exec('useradd -l -g www-data -k /var/www/skel -m -s ' . escapeshellarg($shell) . ' ' . escapeshellarg($system_account));
exec('useradd -l -g www-data -m -s ' . escapeshellarg($shell) . ' ' . escapeshellarg($system_account));
//generate default hosting page
$home = "/home/$system_account";
$dir = "$home/www";
$file = "$dir/index.hosting.html";
if (!is_dir($dir)) {
mkdir($dir, 0755, true);
}
$content = sprintf(
'<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Site hosted by %s service</title>
<meta name="robots" content="noindex">
</head>
<body>
<p>This site is hosted by <a href="http://%s" target="_blank" rel="noopener">%s service</a>.</p>
</body>
</html>',
htmlspecialchars(SITE_NAME, ENT_QUOTES, 'UTF-8'),
htmlspecialchars(ADDRESS, ENT_QUOTES, 'UTF-8'),
htmlspecialchars(SITE_NAME, ENT_QUOTES, 'UTF-8')
);
file_put_contents($file, $content);
chown($dir, $system_account);
chgrp($dir, 'www-data');
chown($file, $system_account);
chgrp($file, 'www-data');
////////
update_system_user_password($system_account, $account['password']);
setup_chroot($system_account, $last_account);
$last_account = $system_account;
Expand Down