1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

SSH command

Discussion in 'Linux and Unix' started by Boylett, Aug 26, 2009.

Thread Status:
Not open for further replies.
Advertisement
  1. Boylett

    Boylett Thread Starter

    Joined:
    Dec 23, 2006
    Messages:
    55
    Hi

    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 its PHP:

    Code:
    OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
    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?
    Thanks.
     
  2. lotuseclat79

    lotuseclat79

    Joined:
    Sep 12, 2003
    Messages:
    20,583
    Hi Boylett,

    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 subforum where they may have more expertise in PHP problem solutions.

    Are you using any Linux distribution - i.e. your computer spec say Windows?

    -- Tom
     
  3. Boylett

    Boylett Thread Starter

    Joined:
    Dec 23, 2006
    Messages:
    55
    Thanks for your reply

    The OS is Linux CentOS 5. I will try those links you gave :)
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/855667