Browse Source

Fix chgrp

Miraty 3 years ago
parent
commit
c87e9372cb
2 changed files with 4 additions and 5 deletions
  1. 2 3
      config.ini
  2. 2 2
      public/auth/register.php

+ 2 - 3
config.ini

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

+ 2 - 2
public/auth/register.php

@@ -18,9 +18,9 @@ if (isset($_POST['username']) AND isset($_POST['password'])) {
 
 
 		// Setup SFTP directory
 		// Setup SFTP directory
 		umask(0002);
 		umask(0002);
-		if (!mkdir("/srv/ht/" . $username, 0775))
+		if (!mkdir(CONF['ht']['ht_path'] . "/" . $username, 0775))
 			exit("ERROR: Can't create directory");
 			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)
 		if ($code !== 0)
 			exit("ERROR: Can't change group");
 			exit("ERROR: Can't change group");