Have a script using Net::SSH:erl that connects to remote machines and executes commands. Running the script via a shell as user apache returns as expected. When trying to run the script from a web browser (running as user apache) the script fails at the the line $session->login($user, $pass).
Debug output from the remote server shows the folloing during a successful connection attempt:
*** START ***
Oct 21 16:55:06 remotehost sshd[2880]: debug1: rexec start in 4 out 4 newsock 4 pipe 6 sock 7
Oct 21 16:55:06 remotehost sshd[2880]: debug1: inetd sockets after dupping: 3, 3
Oct 21 16:55:06 remotehost sshd[2880]: Connection from x.y.z.21 port 1023
Oct 21 16:55:06 remotehost sshd[2880]: debug1: Client protocol version 2.0; client software version 1.29
Oct 21 16:55:06 remotehost sshd[2880]: debug1: no match: 1.29
Oct 21 16:55:06 remotehost sshd[2880]: debug1: Enabling compatibility mode for protocol 2.0
Oct 21 16:55:06 remotehost sshd[2880]: debug1: Local version string SSH-2.0-OpenSSH_3.9p1
Oct 21 16:55:08 remotehost sshd[2880]: debug1: PAM: initializing for "root"
Oct 21 16:55:08 remotehost sshd[2880]: debug1: PAM: setting PAM_RHOST to "x.y.z.21"
Oct 21 16:55:08 remotehost sshd[2880]: debug1: PAM: setting PAM_TTY to "ssh"
Oct 21 16:55:08 remotehost sshd[2880]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Oct 21 16:55:08 remotehost sshd[2880]: debug1: trying public key file /root/.ssh/authorized_keys
Oct 21 16:55:08 remotehost sshd[2880]: debug1: matching key found: file /root/.ssh/authorized_keys, line 3
Oct 21 16:55:08 remotehost sshd[2880]: Found matching DSA key:
*** END ***
However, via the browser, the following debug log is produced:
*** START ***
Oct 21 16:53:10 remotehost sshd[1268]: debug1: rexec start in 4 out 4 newsock 4 pipe 6 sock 7
Oct 21 16:53:10 remotehost sshd[31443]: debug1: Forked child 1268.
Oct 21 16:53:10 remotehost sshd[1268]: debug1: inetd sockets after dupping: 3, 3
Oct 21 16:53:10 remotehost sshd[1268]: Connection from x.y.z.21 port 40015
Oct 21 16:53:10 remotehost sshd[1268]: debug1: Client protocol version 2.0; client software version 1.29
Oct 21 16:53:10 remotehost sshd[1268]: debug1: no match: 1.29
Oct 21 16:53:10 remotehost sshd[1268]: debug1: Enabling compatibility mode for protocol 2.0
Oct 21 16:53:10 remotehost sshd[1268]: debug1: Local version string SSH-2.0-OpenSSH_3.9p1
Oct 21 16:53:11 remotehost sshd[1268]: debug1: PAM: initializing for "root"
Oct 21 16:53:11 remotehost sshd[1268]: debug1: PAM: setting PAM_RHOST to "x.y.z.21"
Oct 21 16:53:11 remotehost sshd[1268]: debug1: PAM: setting PAM_TTY to "ssh"
Oct 21 16:53:11 remotehost sshd[1268]: debug1: do_cleanup
Oct 21 16:53:11 remotehost sshd[1268]: debug1: PAM: cleanup
*** END ***
As this all works fine at the shell, I'm a bit lost as to what the difference could be. Any pointers?
Regs.
Iain.
Debug output from the remote server shows the folloing during a successful connection attempt:
*** START ***
Oct 21 16:55:06 remotehost sshd[2880]: debug1: rexec start in 4 out 4 newsock 4 pipe 6 sock 7
Oct 21 16:55:06 remotehost sshd[2880]: debug1: inetd sockets after dupping: 3, 3
Oct 21 16:55:06 remotehost sshd[2880]: Connection from x.y.z.21 port 1023
Oct 21 16:55:06 remotehost sshd[2880]: debug1: Client protocol version 2.0; client software version 1.29
Oct 21 16:55:06 remotehost sshd[2880]: debug1: no match: 1.29
Oct 21 16:55:06 remotehost sshd[2880]: debug1: Enabling compatibility mode for protocol 2.0
Oct 21 16:55:06 remotehost sshd[2880]: debug1: Local version string SSH-2.0-OpenSSH_3.9p1
Oct 21 16:55:08 remotehost sshd[2880]: debug1: PAM: initializing for "root"
Oct 21 16:55:08 remotehost sshd[2880]: debug1: PAM: setting PAM_RHOST to "x.y.z.21"
Oct 21 16:55:08 remotehost sshd[2880]: debug1: PAM: setting PAM_TTY to "ssh"
Oct 21 16:55:08 remotehost sshd[2880]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Oct 21 16:55:08 remotehost sshd[2880]: debug1: trying public key file /root/.ssh/authorized_keys
Oct 21 16:55:08 remotehost sshd[2880]: debug1: matching key found: file /root/.ssh/authorized_keys, line 3
Oct 21 16:55:08 remotehost sshd[2880]: Found matching DSA key:
*** END ***
However, via the browser, the following debug log is produced:
*** START ***
Oct 21 16:53:10 remotehost sshd[1268]: debug1: rexec start in 4 out 4 newsock 4 pipe 6 sock 7
Oct 21 16:53:10 remotehost sshd[31443]: debug1: Forked child 1268.
Oct 21 16:53:10 remotehost sshd[1268]: debug1: inetd sockets after dupping: 3, 3
Oct 21 16:53:10 remotehost sshd[1268]: Connection from x.y.z.21 port 40015
Oct 21 16:53:10 remotehost sshd[1268]: debug1: Client protocol version 2.0; client software version 1.29
Oct 21 16:53:10 remotehost sshd[1268]: debug1: no match: 1.29
Oct 21 16:53:10 remotehost sshd[1268]: debug1: Enabling compatibility mode for protocol 2.0
Oct 21 16:53:10 remotehost sshd[1268]: debug1: Local version string SSH-2.0-OpenSSH_3.9p1
Oct 21 16:53:11 remotehost sshd[1268]: debug1: PAM: initializing for "root"
Oct 21 16:53:11 remotehost sshd[1268]: debug1: PAM: setting PAM_RHOST to "x.y.z.21"
Oct 21 16:53:11 remotehost sshd[1268]: debug1: PAM: setting PAM_TTY to "ssh"
Oct 21 16:53:11 remotehost sshd[1268]: debug1: do_cleanup
Oct 21 16:53:11 remotehost sshd[1268]: debug1: PAM: cleanup
*** END ***
As this all works fine at the shell, I'm a bit lost as to what the difference could be. Any pointers?
Regs.
Iain.