WordPress.org

Ready to get started?Download WordPress

Forums

Update plugins using SFTP with non-standard port (18 posts)

  1. erick_paper
    Member
    Posted 3 years ago #

    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!

  2. ClaytonJames
    Member
    Posted 3 years ago #

  3. Jackie
    Member
    Posted 3 years ago #

    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.

  4. erick_paper
    Member
    Posted 3 years ago #

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

  5. Jackie
    Member
    Posted 3 years ago #

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

  6. erick_paper
    Member
    Posted 3 years ago #

    Doesn't. Because the option for "Upgrade automatically" is not SFTP. It is "FTP SSL". Which is not the same thing.

  7. Samuel B
    moderator
    Posted 3 years ago #

  8. erick_paper
    Member
    Posted 3 years ago #

    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

  9. erick_paper
    Member
    Posted 3 years ago #

    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.

  10. ClaytonJames
    Member
    Posted 3 years ago #

    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.

  11. Jackie
    Member
    Posted 3 years ago #

    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.

  12. ClaytonJames
    Member
    Posted 3 years ago #

    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

  13. ClaytonJames
    Member
    Posted 3 years ago #

    libcss2

    ooops. big typo, there.. libssh2

    (not to be confused with libdvdcss2) :p

  14. Samuel Wood (Otto)
    Tech Ninja
    Posted 3 years ago #

    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.

  15. erick_paper
    Member
    Posted 3 years ago #

    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.

  16. erick_paper
    Member
    Posted 3 years ago #

    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?

  17. erick_paper
    Member
    Posted 3 years ago #

    Well maybe WordPress developers just need to start paying attention to this pretty important issue. They seem to be ignoring it for quite a while.

    http://core.trac.wordpress.org/ticket/10348

  18. erick_paper
    Member
    Posted 2 years ago #

    Still doesn't work. For such a mainstream software, in its version 3.3, it's embarrassing that such a basic and prevalent issue is unsupported.

    WordPress does NOT support sftp. Period. With all the libssh2 etc installed and working, and all other software working. Joomla and Drupal support this very basic feature.

    Welcome any thoughts. Otherwise, hope some self-respecting dev from WordPress is reading this.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags