Results 1 to 2 of 2

Thread: How to use SSH command

  1. #1
    allister135 is offline Member
    Join Date
    Jun 2009
    Posts
    35
    Rep Power
    0

    Default How to use SSH command

    I'm trying to run the SSH command from PHP to be able to execute ssh commands on remote servers. I have tried this (ran from PHP/apache):

    ssh -v -l user -o stricthostkeychecking=no host.tld
    which works from command line, but not from PHP. Here's the output when it’s PHP:
    Code:
    OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Applying options for *
    debug1: Connecting to --- [---] port 22.
    debug1: Connection established.
    debug1: identity file /var/www/.ssh/identity type -1
    debug1: identity file /var/www/.ssh/id_rsa type -1
    debug1: identity file /var/www/.ssh/id_dsa type -1
    debug1: loaded 3 keys
    debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
    debug1: match: OpenSSH_4.3 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_4.3
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-cbc hmac-md5 none
    debug1: kex: client->server aes128-cbc hmac-md5 none
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Host '---' is known and matches the RSA host key.
    debug1: Found key in /var/www/.ssh/known_hosts:1
    debug1: ssh_rsa_verify: signature correct
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_SERVICE_REQUEST sent
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey,gssapi-with-mic,password
    debug1: Next authentication method: gssapi-with-mic
    debug1: Unspecified GSS failure. Minor code may provide more information
    No credentials cache found

    debug1: Unspecified GSS failure. Minor code may provide more information
    No credentials cache found

    debug1: Unspecified GSS failure. Minor code may provide more information
    No credentials cache found

    debug1: Next authentication method: publickey
    debug1: Trying private key: /var/www/.ssh/identity
    debug1: Trying private key: /var/www/.ssh/id_rsa
    debug1: Trying private key: /var/www/.ssh/id_dsa
    debug1: Next authentication method: password
    debug1: read_passphrase: can't open /dev/tty: No such device or address
    debug1: Authentications that can continue: publickey,gssapi-with-mic,password
    Permission denied, please try again.
    debug1: read_passphrase: can't open /dev/tty: No such device or address
    debug1: Authentications that can continue: publickey,gssapi-with-mic,password
    Permission denied, please try again.
    debug1: read_passphrase: can't open /dev/tty: No such device or address
    debug1: Authentications that can continue: publickey,gssapi-with-mic,password
    debug1: No more authentication methods to try.
    Permission denied (publickey,gssapi-with-mic,password).

    How can I get it to work?

  2. #2
    Alan Knott is offline Senior Member
    Join Date
    Apr 2009
    Posts
    141
    Rep Power
    4

    Default

    Obviously, there is an authentication problem when PHP is used rather than the command line. Check out OpenSSH and GSSAPI Mechglue to determine whether you have the patch they talk about in your software.

    Also, check out Perl GSSAPI Bindings to see if you are missing some/all/any. Also, does the Apache user have the correct permissions to write to the kerberos cache? The problem may be an imap server problem rather than php.

    Read this web page: Bug #33500 imap_open() fails when the server advertises GSSAPI. Make sure all of your software is up-to-date. Also. Why not try this post in the Web Design and Development sub forum where they may have more expertise in PHP problem solutions.Are you using any Linux distribution - i.e. your computer spec say Windows?

Similar Threads

  1. Ls command for MAC OS X
    By LewisClark in forum Operating System
    Replies: 2
    Last Post: 02-09-2010, 02:17 PM
  2. Typing of more than one command.
    By sanita in forum Technologies
    Replies: 1
    Last Post: 04-14-2009, 12:54 PM
  3. The CHKDSK command
    By Cadmus4778 in forum Everything Else
    Replies: 0
    Last Post: 11-29-2008, 10:35 AM
  4. Format Command
    By Cadmus4778 in forum Everything Else
    Replies: 0
    Last Post: 11-29-2008, 10:21 AM
  5. The CLS Command
    By Cadmus4778 in forum Everything Else
    Replies: 0
    Last Post: 11-29-2008, 10:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48