• Resolved wkdwich

    (@wkdwich)


    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://[email protected]: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!

    https://www.ads-software.com/plugins/ssh-sftp-updater-support/

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter wkdwich

    (@wkdwich)

    I’ll quickly add that I always connect via filezila where once connected the title bar shows:
    sftp://[email protected]: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]

    Thread Starter wkdwich

    (@wkdwich)

    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 ??

    Plugin Author TerraFrost

    (@terrafrost)

    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.

    https://plugins.svn.www.ads-software.com/ssh-sftp-updater-support/trunk/

    Thanks!

    @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.

    Thread Starter wkdwich

    (@wkdwich)

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

    Thread Starter wkdwich

    (@wkdwich)

    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 ??

    Plugin Author TerraFrost

    (@terrafrost)

    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

    Thread Starter wkdwich

    (@wkdwich)

    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!

    Plugin Author TerraFrost

    (@terrafrost)

    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.

    Thread Starter wkdwich

    (@wkdwich)

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

    Thread Starter wkdwich

    (@wkdwich)

    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…

    Thread Starter wkdwich

    (@wkdwich)

    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]

    Thread Starter wkdwich

    (@wkdwich)

    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

    Thread Starter wkdwich

    (@wkdwich)

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

    Plugin Author TerraFrost

    (@terrafrost)

    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

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Still cant connect SFTP’ is closed to new replies.