I am trying to implement a web console using the PHPterm . By the PHPterm most of the commands can run in the console.But can't login to a server by using the SSH command.
It will display an error that host key verification failed.Is there any other web console supporting the SSH command using PHP and ajax.
As far as I can imagine, PHPterm is e mere Unix shell emulator. It just gives you the possibility to execute shell commands from the browser, providing you the look and feel of a normal shell.
If you're receiving a "host key verification failed" error, I guess the problem resides in the SSH connection rather than in PHPterm itself.
Did you try to perform the SSH connection without using PHP term, but a simple terminal?
Is your public in the right place?
Is your public key contained in the authorized key?
The verbose mode for SSH could help you in identifying the reason of the problem.
Related
I want to make an checker to check RDP IP with user and password
I've tried to install guacamole server I install it on ubuntu and it works good and connects well but I can't make any check using php or any coding language with it because its system is so complicated
so if any one have any idea about how to check RDP IP with user and password using any coding please let me know
You can use command line RDP clients (or this one) for linux if you environment is a Linux (or MacOS), or run RDP client from command line if you using Windows.
guacamole is not good idea for automation. You need to run web-side javascript to connect, so Selenium or Chrome headless will be only possible solution as I know.
EDIT 1: How to run remote command
Set SSH passwordless connection to freerdp server
Run freerdp command on remote server via SSH connection
$process = new Process(['ssh', 'user#serverB' 'freerdp ...']);
$process->run();
In other way you can create standalone PHP service on serverB which trying to run local freerdp command with requested IP (or user?) and returning result
I've managed from each pull my server send me a notification. My php script, execute a shell script who is responsible to update my repos, but I'm getting this message
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
These are my files:
PHP: https://gist.github.com/rodreego/567176913cbe9d925907
Shell: https://gist.github.com/rodreego/964bd48287bff4eafc8a
I've tried to log my user who's executing this shell script, but he's coming blank. Is there something to do with it? I mean, If I run my scripts from my prompt shell, work fine, but when I attempt deploy from server notification, doesn't.
I'm looking for a solution to SSH through an existing SSH connection and execute a command with PHP. I've had this working with a simple command. Example:
$result = shell_exec("ssh user#server1 ssh user#server2 ls");
This works when run through CLI but not CGI. I've worked a bit with PHPSecLib but cannot figure out how to open the second connection, once I have a connection to server1.
Anyone have any advice?
When running through CGI, your PHP script probably runs as the web server user, and that user doesn't have access to your SSH keys. Either give the web server user your SSH keys or arrange for the PHP script to run as your user e.g. using suPHP.
And make sure to secure your application so your keys don't get stolen :)
What about $ssh->exec('ssh user#server2 ls')?
I have a CentOS 5.5 server running a local telnet daemon (which is only accessible from localhost) which prints out a list of active users on our accounting system when sent the correct commands through telnet. I need to make this information available on our intranet website which uses PHP.
I've written a Python script using the telnetlib modules to run locally on the CentOS server which simply captures the output of the telnet command and prints them to stdout. I've setup key based ssh between the web server and the CentOS server to run the python script remotely from the web server. I can execute the script successfully from the web server using ssh and it prints the list of users to stdout on the webserver. I was hoping to be able to execute this SSH command and capture the results into a variable to display on the website.
However, I can't get exec(), shell_exec(), passthru() or any other PHP exec function to display the data. I'm well aware that I may be approaching this from the totally wrong angle! What would be the best way to capture the output from ssh?
Why don't you redirect your stdout to a file. Then use your php website framework to read the file and display the results
i can't figure out how i should access the repository from a CakePHP project called fredistrano (you can do CakePHP deploys with a web 2.0 interface). i have fredistrano in my web broadcasting directory on a shared unix web server. when i use tortoisesvn from my laptop, i have to use svn+ssh://username#domain.com/svnpath/trunk/. i tried using the same thing in fredistrano, but i keep getting the svn command error "svn: Network connection closed unexpectedly". i copied and pasted the command: svn export --non-interactive --username myusername --password mypwd svn+ssh://myusername#mydomain.com/home/myusername/svn/mydomain.com/trunk tmpDir 2>&1 into my SSH terminal connected to the shared server and i get a prompt for a password, which i believe is actual a prompt for the SSH password and not the SVN password (see this post). fredistrano is failing because it can't deal w/ the SSH password prompt. i noticed in the fredistrano documentation that the example uses http://ipaddress/svn/test for the SVN URL. i copied my svn to my web broadcasting direrctory and tried this but get a connection refused error. my shared hosting provider is pretty strict and i doubt that i can use that. is there a way i can get svn+ssh to work w/ a PHP script like this (fredistrano is just using shell_exec() to execute svn commands)? is there a way i can get just get svn, http, or https working (or any other method that i don't know about)?
I am interested in this problem, too, and I hope that I'm close to the solution.
I haven't tried to put it into work in my application due to the lack of time and other high-priority tasks, but I guess that it should look something like this:
shell_exec(svn something svn+ssh://...)
$response = trim(fgets(STDIN))
[then check if the response contains password prompt text]
fwrite(STDOUT, 'yourpassword');
[analyze the next response and see if SVN has returned the requested information - log, info, whatever]
"svn: Network connection closed unexpectedly" most probably means that your host has restricted/forbidden access to other hosts. This might imply using sockets at all (SVN, HTTP, etc.) or maybe only non-HTTP. In this case you should try setting up your SVN server to allow HTTP requests (e.g. using mod_dav_svn for Apache).
This is only a guess - see my comment to your question.
How do you authenticate from your dev machine to the svn-server? You might be using a key to authenticate (Do you have putty pageant running?)
maybe check out the Subversion PHP Module (1.0.3) instead of wrapping shell_exec; it requires building from source, with phpize, ./configure and make (just built it against PHP 5.6 and Subversion 1.9.5)... while the Apache Module mod_dav (Subversion via HTTP/HTTPS) is not required for version control, rather an optional method of accessing the repository.