Fix chgrp

This commit is contained in:
Miraty 2022-05-20 00:56:04 +02:00
parent 46218fb3d3
commit c87e9372cb
2 changed files with 4 additions and 5 deletions

View File

@ -10,9 +10,6 @@ ipv6_example = "2001:db8::3"
; From RFC5737: IPv4 Address Blocks Reserved for Documentation
ipv4_example = "203.0.113.42"
[auth]
chgrp_path = "/usr/bin/chgrp"
[reg]
knotc_path = "/usr/sbin/knotc"
registry = niver.test
@ -30,6 +27,7 @@ public_sftp_port = 2022
https_port = 42443
internal_onion_http_port = 9080
sudo_path = "/usr/bin/sudo"
chgrp_path = "/usr/bin/chgrp"
systemctl_path = "/usr/bin/systemctl"
certbot_path = "/usr/bin/certbot"
; Nginx configuration directory
@ -38,3 +36,4 @@ nginx_config_path = "/etc/nginx/ht"
tor_config_path = "/etc/tor/instances/niver/torrc"
; Tor keys directory
tor_keys_path = "/var/lib/tor-instances/niver/keys"
sftpgo_group = sftpgo

View File

@ -18,9 +18,9 @@ if (isset($_POST['username']) AND isset($_POST['password'])) {
// Setup SFTP directory
umask(0002);
if (!mkdir("/srv/ht/" . $username, 0775))
if (!mkdir(CONF['ht']['ht_path'] . "/" . $username, 0775))
exit("ERROR: Can't create directory");
exec(CONF['ht']['sudo_path'] . " " . CHGRP_PATH . " sftpgo " . CONF['ht']['ht_path'] . "/" . $username, $stdout, $code);
exec(CONF['ht']['sudo_path'] . " " . CONF['ht']['chgrp_path'] . " " . CONF['ht']['sftpgo_group'] . " " . CONF['ht']['ht_path'] . "/" . $username, $stdout, $code);
if ($code !== 0)
exit("ERROR: Can't change group");