Support » Fixing WordPress » Update plugins using SFTP with non-standard port

  • We have security measures on our hosting provider’s platform, one of which is that SFTP doesn’t use the usual port 22, but some other port number.

    How or where can I set this up so that WordPress “automatic” upgrades of plugins etc knows how to connect?

    Thanks!

Viewing 15 replies - 1 through 15 (of 17 total)
  • Jackie

    (@wordpressmacuser)

    Never mind. I figured it out. I was trying to figure out which wp file to edit but i see it now in the link

    To our lovely peeps at wordpress.org, I hope you see this post. A lot of people use non-standard ports for their ssh/sftp connections.

    Clayton, that’s for SSH. I was asking about SFTP. So it doesn’t work, naturally. Any other ideas?

    Jackie

    (@wordpressmacuser)

    Edit: Doesn’t work for me either. I tried changing the include files for both FTP and SSH2.

    Doesn’t. Because the option for “Upgrade automatically” is not SFTP. It is “FTP SSL”. Which is not the same thing.

    Not only that, the WP install I have 3.0.4 seems to force a port 21, even if I edit that SSH2.php file.

    Heres the error message:

    Failed to connect to FTP Server DOMAIN.com:21

    Samuel. Thanks. I used that to add the following to my server

    define('FS_METHOD', 'ftpext');
    define('FTP_USER', 'me');
    define('FTP_PASS', 'mypass');
    define('FTP_HOST', 'DOMAIN.com:2255');
    define('FTP_SSL', true);

    Doesn’t work. When I click on upgrade automatically it just sits there.

    Clayton, that’s for SSH. I was asking about SFTP. So it doesn’t work, naturally. Any other ideas?

    Yes. Make sure you are not confused about what transfer protocol you are actually after.

    SFTP is file transfer over SSH – not the same as ftps, which is ftp transfer over ssl/tls. Two completely different things. So if you’re asking about SFTP, I think you could be asking about SSH.

    Jackie

    (@wordpressmacuser)

    Anyone ever figure this out? I’m still stumped 🙁

    Just trying to update wordpress/plugins here. Looks like this will force me to change my SSH port just to do so and then switch back again.

    If you are truly asking about using SFTP over SSH, then the answer is that your server has to have libcss2 installed and functioning. If you read the beginning of the file I linked to above for erick_paper, you will even see some basic instructions/tips for enabling WordPress’s ability to use SSH2. The instructions are generic, and you may actually have to do a little more work than that depending on your servers OS.

    Once libssh2 is functioning on your server, you will see a new file transfer option in the upload dialog in your dashboard that will allow you to select SSH2, and additional fields where you can enter your public/private key pair for authentication.

    The non-standard port issue will be a secondary consideration at this point. As far as setting a non-standard SSH port, I will defer any and all correct answers to the experts (of which I am not), but on line 67, in the file I linked to above for erick_paper, it appears as though the information located under the notation
    “// Set defaults:” would be where one would consider making their changes. Here is a link to the first hit I get on Google when searching for others with a similar pursuit.

    WordPress Auto Update via SFTP on a Non-standard Port

    [edit] ..then there’s this, of course Enabling SSH Upgrade Access

    libcss2

    ooops. big typo, there.. libssh2

    (not to be confused with libdvdcss2) :p

    Using example.com:123 for the hostname should cause it to use the port of 123. See the code in wp-admin/includes/file.php, line 935.

    Otto, where should I specify the host name? In the wp-admin file? Should I hard code it?

    Also, it is NOT only about specifying the port. The port number is for SSH2 and SFTP (ftp over SSH2) and not for regular FTP, whereas WP tries to connect over regular FTP.

    Am I missing something? Basically, specifying port number doesn’t work.

    ClaytonJames, about this link:

    Enabling SSH Upgrade Access

    I have seen it. But PECL command mentioned there doesn’t work. This is on my main server, with root access:

    ~> pecl install ssh2
    Failed to download pecl/ssh2 within preferred state "stable", latest release is version 0.11.2, stability "beta", use "channel://pecl.php.net/ssh2-0.11.2" to install
    install failed

    Any ideas?

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Update plugins using SFTP with non-standard port’ is closed to new replies.