|
@@ -0,0 +1,50 @@
|
|
|
|
|
+<?php
|
|
|
|
|
+
|
|
|
|
|
+# echo $_POST["oldpasswd"];
|
|
|
|
|
+# echo $_POST["username"];
|
|
|
|
|
+# echo $_POST["path"];
|
|
|
|
|
+if( $_POST["oldpasswd"] != "ja5ooYiPec8sheic9eeboothoo9auTie")
|
|
|
|
|
+{
|
|
|
|
|
+ echo "wrong pass";
|
|
|
|
|
+# die;
|
|
|
|
|
+}
|
|
|
|
|
+# sudo chown root /home/share/vsftpd/passwd
|
|
|
|
|
+#exec ("/usr/bin/sudo chown root /home/share/vsftpd/passwd");
|
|
|
|
|
+if( isset( $_POST["fixpermissions"]))
|
|
|
|
|
+{
|
|
|
|
|
+ exec ("/usr/bin/sudo /bin/chown root /home/share/vsftpd/passwd /home/share/vsftpd/users/*");
|
|
|
|
|
+ echo "permissions fixed";
|
|
|
|
|
+ die;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+if( isset( $_POST["write"]) ){
|
|
|
|
|
+ $stringData = "write_enable=YES\n";
|
|
|
|
|
+}
|
|
|
|
|
+else {
|
|
|
|
|
+ $stringData = "write_enable=NO\n";
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+# File formart
|
|
|
|
|
+# write_enable=YES
|
|
|
|
|
+# local_root=/home/share/write/public
|
|
|
|
|
+# xferlog_file=/home/share/vsftpd/log/madhu
|
|
|
|
|
+#
|
|
|
|
|
+
|
|
|
|
|
+$myFile = "/home/share/vsftpd/users/".$_POST["username"];
|
|
|
|
|
+
|
|
|
|
|
+$fh = fopen($myFile, 'w') or die("can't open file");
|
|
|
|
|
+echo "creating ".$myFile." with content:<br/>";
|
|
|
|
|
+
|
|
|
|
|
+fwrite($fh, $stringData);
|
|
|
|
|
+echo $stringData."<br/>\n";
|
|
|
|
|
+$stringData = "local_root=/home/share/".$_POST["path"]."/\n";
|
|
|
|
|
+fwrite($fh, $stringData);
|
|
|
|
|
+echo $stringData."<br/>\n";
|
|
|
|
|
+#$stringData = "xferlog_file=/home/share/vsftpd/log/".$_POST["username"].".log\n";
|
|
|
|
|
+#fwrite($fh, $stringData);
|
|
|
|
|
+#echo $stringData."<br/>\n";
|
|
|
|
|
+fclose($fh);
|
|
|
|
|
+exec ("/bin/chmod 660 /home/share/vsftpd/users/".$_POST["username"]);
|
|
|
|
|
+exec ("/usr/bin/sudo /bin/chown root /home/share/vsftpd/passwd /home/share/vsftpd/users/*");
|
|
|
|
|
+
|
|
|
|
|
+?>
|