0

I have successed connected and authorized via ssh2 functions. But I can't exec command via ssh2_exec() function.

Notoriously get this error:

ssh2_exec(): Unable to request command execution on remote host

I was trying pass '/bin/ls' 'ls -l' nothing works. Also I have changed user and getting the same error.

EDIT:

I have changed remote host and all works as expected. How to set up first host? User name that I'm using in credentials has bash shell enabled. So I might log in via putty and run same command that I can't via PHP.

Wojtek B
  • 160
  • 1
  • 12

1 Answers1

0

Sorted!

Problem was that I have default port 22 assigned to SFTP service that's why I was successfuly connecting to remote host but I could not execute command.

SSH listening on port 23 on that problematic machine, so I changed my script to port 23 and all works as expected now.

Wojtek B
  • 160
  • 1
  • 12