WordPress.org

Ready to get started?Download WordPress

Forums

SSH SFTP Updater Support
[resolved] Still cant connect SFTP (17 posts)

  1. wkdwich
    Member
    Posted 8 months ago #

    I have stayed away from WP for 3 yrs because of the inability to auto update over a SFTP connection.. yes I mean SFTP .. not anything else :) I have FTP permanently disabled on my server and want to keep it that way. I have a new project I would love to use WP, and was thrilled to see this plugin.. but I cant get it to connect..

    So.. first the WP installed fine, I activated the ssh-sftp plugin and tried to connect to upgrade to v3.7 but it wont..

    I use a non-conventional port also.. so I tried:

    domain.com
    user
    pass

    sftp://user@domain.com:1234 (port #)
    user
    pass

    domain.com:1234 (port #)
    user
    pass

    I even tried using the root user/pass

    I just continually get
    Error: There was an error connecting to the server, Please verify the settings are correct.

    I see nothing in my error logs...

    I dont see an SFTP option only:
    FTP FTPS (SSL) SSH2

    and I have no idea if I have a passphrase, if it is needed, or how to make one if I do need it so

    Please help me out here I really really want to be able to use WP now!
    thanks!

    http://wordpress.org/plugins/ssh-sftp-updater-support/

  2. wkdwich
    Member
    Posted 8 months ago #

    I'll quickly add that I always connect via filezila where once connected the title bar shows:
    sftp://user@domain.com:1234

    the boxes in the connection show:
    domain.com 1234 (my port#)
    SFTP - SSH File Transfer Protocol
    Login type: Ask for password
    User: [user name]

  3. wkdwich
    Member
    Posted 8 months ago #

    I'm determined tonight :) I am working my way through all the support posts.. now tried:
    localhost:1234 (my port)
    same user and password I know works still no connection..

    I uncommented the line:
    define('NET_SFTP_LOGGING', NET_SFTP_LOG_REALTIME);
    and see no additional messages

    I may be back before the night is through :)

  4. TerraFrost
    Member
    Plugin Author

    Posted 8 months ago #

    domain.com:1234 (port #)
    user
    pass

    That's the one you want.

    I dont see an SFTP option only:
    FTP FTPS (SSL) SSH2

    SSH2 is SFTP.

    Anyway can you try the latest trunk version of this plugin? eg.

    http://plugins.svn.wordpress.org/ssh-sftp-updater-support/trunk/

    Thanks!

  5. huuanito
    Member
    Posted 8 months ago #

    @wkdwich I just spent many hours debugging a similar issue, also with a non-standard port, with this really excellent plugin (thanks TerraFrost). I was getting connection refused over and over. Turned out it was a config issue with SSH due to multiple aliases onto the box in question for some odd reason SSH would only recognize the primary name and not the aliases. I could SSH from external but not localhost even with the firewall completely open.I had to add a
    ListenAddress 127.0.0.1
    to sshd_config and then it just worked.
    I used some code from TerraFrost that I found in another thread to first confirm connection:
    <?php
    include('Net/SFTP.php');

    $sftp = new Net_SFTP('as.ucsd.edu',7345);
    if (!$sftp->login('aswebmaster', 'tAswsPhbC!')) {
    exit('Login Failed');
    }

    echo dirname(__FILE__) . '
    ';
    echo $sftp->pwd();
    ?>
    then I hacked SFTP.php to find where it was balking.
    Then I found this useful script to check connections via localhost:
    <?php
    function connect($host) {
    $faultcode = null;
    $faultstring = null;
    $port = 1234;
    $timeout = 10;
    $conn = fsockopen($host, $port, $faultcode, $faultstring, $timeout);
    if (!$conn) {
    echo 'faultcode=' .$faultcode .', faultstring=' .$faultstring
    ."\n";
    } else {
    echo "Connected to $host OK\n";
    } // if
    return $conn;
    } // function

    $result = connect('localhost');
    echo "
    ";
    $result = connect('127.0.0.1');
    echo "
    ";
    $result = connect('yoursite.tld');
    echo "
    ";
    $result = connect('www.someknownsite.com');
    ?>

    Hope this might help you debug your issue.

  6. wkdwich
    Member
    Posted 8 months ago #

    Thanks to both of you.. I am out of town until next Sunday. This will be top of my list when I get back..

  7. wkdwich
    Member
    Posted 8 months ago #

    well, I couldnt stand it, and tried tonight..

    TerraFrost, I did a compare and only saw one file that was changed.. I deactivated the plugin, changed that one file (sftp.php) and reactivated.. I went to the updater and put in my credentials:

    domain.com:1234 [my port #]
    [user name]
    [password]
    left the private key all blank
    chose SSH2 as the connection, cross my fingers and clicked proceed.. and got this:

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 122880 bytes) in /home/wicked/public_html/wordpress/wp-content/plugins/ssh-sftp-updater-support/phpseclib/Crypt/RSA.php on line 1002

    this is progress at least... a response from the server is better than the nothing I was getting :)

    that message translates to lines 998-1004 in my version here:

    $crypto->setKey($symkey);
                        $crypto->setIV($iv);
                        $decoded = $crypto->decrypt($ciphertext);
                    } else {
                        $decoded = preg_replace('#-.+-|[\r\n]| #', '', $key);
                        $decoded = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $decoded) ? base64_decode($decoded) : false;
                    }

    so now what???

    Limited access here, so that other hack post will have to wait till I can see it better on a big screen :)

  8. TerraFrost
    Member
    Plugin Author

    Posted 8 months ago #

    Maybe try replacing the phpseclib directory used by this plugin with the phpseclib-master\phpseclib directory in https://github.com/phpseclib/phpseclib/archive/master.zip

  9. wkdwich
    Member
    Posted 8 months ago #

    maybe closer... a different error.. I uploaded all the files in that zip phpseclib folder to the corresponding folder in the module.. I just realized I did not deactivate and reactivate the module.. would that have an effect?

    Is there another module or addin I should have in addition to this one??? The prospective clinet called tonight.. hes very anxious to get started so I really need this to work!

    Parse error: syntax error, unexpected $end in /home/wicked/public_html/wordpress/wp-content/plugins/ssh-sftp-updater-support/phpseclib/Net/SSH2.php on line 3062

    Lines 3057-3067 in that file:

    while (strlen($data) > $max_size) {
                if (!$this->window_size_client_to_server[$client_channel]) {
                    $this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST;
                    // using an invalid channel will let the buffers be built up for the valid channels
                    $output = $this->_get_channel_packet(-1);
                    $this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST;
                    $max_size = min(
                        $this->packet_size_client_to_server[$client_channel],
                        $this->window_size_client_to_server[$client_channel]
                    ) - 4;
                }

    Thanks for the help!

  10. TerraFrost
    Member
    Plugin Author

    Posted 8 months ago #

    Nothing in your code snippet looks incorrect and, in any event, I'm using the latest Git version myself and am not getting syntax errors.

    Can you post your full Net/SSH2.php and a copy of your phpinfo()?

    Thanks.

  11. wkdwich
    Member
    Posted 8 months ago #

    Yes, thank you I will do that late tomorrow evening..

  12. wkdwich
    Member
    Posted 8 months ago #

    hummmmm... ok maybe cause I was working remote... something is very wrong here.. the version online is very different from the original SSH2.php and the 2nd version you pointed me at.. I've been up since 3.30am and am about to pass out on the keyboard.. this is def tomorrow's project to start from scratch on this one again.. stay tuned...

  13. wkdwich
    Member
    Posted 8 months ago #

    OK back on it...
    completely removed and started from scratch.. still no luck..

    with sftp.php updated from git and the phpseclib library replaced I am getting:
    'To perform the requested action, WordPress needs to access your web server. Please enter your FTP or SSH credentials to proceed. If you do not remember your credentials, you should contact your web host.'
    I confirmed I am using the correct password.. and the correct port #

    I created the test connection file from the beginning of huuanito's post above and got this
    '
    Notice: Connection closed by server in /home/user/public_html/wordpress/wp-content/plugins/ssh-sftp-updater-support/phpseclib/Net/SSH2.php on line 894
    Login Failed'

    that line in that file:

    if (feof($this->fsock)) {
                user_error('Connection closed by server');
                return false;
            }

    [Excessive code moderated]

  14. wkdwich
    Member
    Posted 8 months ago #

    So I am also thinking.... I really have the server locked down.. its a cpanel box.. in the host access control I have just my IP address as it is when connected to my cable connection in the home/office

    'sshd xxx.xxx.xx.xxx ALLOW
    sshd ALL DENY'

    could this be part of the issue with my connection?? If so I would appreciate suggestions on how to manage this connection task!

    thanks

  15. wkdwich
    Member
    Posted 8 months ago #

    ack I also see it would not allow the posting of the file and code you requested ;(

  16. TerraFrost
    Member
    Plugin Author

    Posted 8 months ago #

    So I am also thinking.... I really have the server locked down.. its a cpanel box.. in the host access control I have just my IP address as it is when connected to my cable connection in the home/office

    'sshd xxx.xxx.xx.xxx ALLOW
    sshd ALL DENY'

    Maybe try adding 127.0.0.1 to that or the IP address of your server.

    ack I also see it would not allow the posting of the file and code you requested ;(

    Try pastebin.com

  17. wkdwich
    Member
    Posted 8 months ago #

    'sshd xxx.xxx.xx.xxx ALLOW
    sshd ALL DENY'

    Maybe try adding 127.0.0.1 to that or the IP address of your server.

    WOOHOOOOO I added the server IP as ALLOW and BINGO!!!!! we have ignition!!!!

    I cant tell you how pleased I am now!!!

Reply

You must log in to post.

About this Plugin

About this Topic