disablePTY() public method

Disable request-pty when using exec()
public disablePTY ( )
Beispiel #1
0
         $ssh->enablePTY();
         $ssh->exec('sudo passwd ' . $user);
         if ($language == "English") {
             $ssh->read('Enter new UNIX password:'******'Retype new UNIX password:'******'passwd: password updated successfully');
         } elseif ($language == "Deutsch") {
             $ssh->read('Geben Sie ein neues UNIX-Passwort ein:');
             $ssh->write($password . "\n");
             $ssh->read('Geben Sie das neue UNIX-Passwort erneut ein:');
             $ssh->write($password . "\n");
             $ssh->read('passwd: Passwort erfolgreich geändert');
         }
         $ssh->disablePTY();
         $ssh->read('[prompt]');
         $ssh->exec("usermod -a -G sudo " . $user);
         $ssh->exec('echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers');
         $ssh->exec('echo "' . $vsftpd . '" >> /etc/vsftpd.conf');
         $ssh->exec('sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -subj "/C=AU/ST=AU/L=AU/O=Internet Widgits Pty Ltd/OU=IT/CN=' . $root . '"');
         $ssh->exec('service vsftpd restart');
         $stmt = $mysqli->prepare("INSERT INTO dedicated(name,os,ip,port,user,password,status,language,os_bit) VALUES (?, ?, ?, ? ,? ,? ,?, ? ,?)");
         $stmt->bind_param('sssissisi', $name, $os_version, $ip, $port, $user, $password, $status, $language, $os_bit);
         $stmt->execute();
         $stmt->close();
         unset($root_password);
         unset($root);
     }
     msg_okay(_dedicated_message_added);
 } else {