Support » Fixing WordPress » annoying WP_filesystem limitations

  • from wp-admin/includes/file.php:

    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param unknown_type $args
     * @return unknown
     */
    function get_filesystem_method($args = array()) {
    	$method = false;
    	if( function_exists('getmyuid') && function_exists('fileowner') ){
    		$temp_file = wp_tempnam();
    		if ( getmyuid() == fileowner($temp_file) )
    			$method = 'direct';
    		unlink($temp_file);
    	}
    
    	if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') ) $method = 'ssh2';
    	if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
    	if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
    	return apply_filters('filesystem_method', $method);
    }

    what if you’re on a shared host that has the ssh2 extension enabled but don’t have an ssh account, yourself? shouldn’t wordpress let you chose which method you want to use?

    also, on my employers hosting machine, ssh2/sftp is the only means by which a server can be accessed. no ftp server is installed and the scripts are run as nobody whereas they’re owner is the owner of the sftp account. it’d be nice if, as such, a pure-php implementation of sftp could be used. kind-of like how wordpress provides a pure-php implementation of ftp.

Viewing 7 replies - 1 through 7 (of 7 total)
  • also, on my employers hosting machine, ssh2/sftp is the only means by which a server can be accessed

    What is you you want to do?

    I have 2 servers with WordPress installations that I access exclusively via SSH-2/SFTP. Never had a problem doing anything I needed.

    What isn’t happening for you? What limitation are you encountering?

    shouldn’t wordpress let you chose which method you want to use?

    Choose which method you use to do what?

    You know, I just re-read your post, and I’m not sure how to interpret what you are really trying to achieve.

    what if you’re on a shared host that has the ssh2 extension enabled but don’t have an ssh account, yourself? shouldn’t wordpress let you chose which method you want to use?

    If you don’t have a valid account for SSH on a server, why would you expect to be able to log in using SSH? Any more than you would expect to log into an FTP server if you don’t have an FTP user account?

    Thread Starter blazerlocal

    (@blazerlocal)

    i have access to two different servers and only have ssh access on one of them. one of them (the one that i do have ssh access to) is my employers hosting machine and the other is a shared host that i use for my own personal stuff.

    Choose which method you use to do what?

    to update your WordPress installation, among other things. that is why (s)ftp support was added to WordPress in the first place, isn’t it?

    to update your WordPress installation, among other things. that is why (s)ftp support was added to WordPress in the first place, isn’t it?

    Yup. It seems likely. And yet I still stand by my previous statement…

    “If you don’t have a valid account for SSH on a server, why would you expect to be able to log in using SSH? Any more than you would expect to log into an FTP server if you don’t have an FTP user account?”

    If you don’t have login credentials for the service on the server, why and how, would you expect (or expect WordPress) to be granted access?

    I don’t think it matters what protocol you use to transfer files. If you don’t have an account for that service on the server, (can’t provide login credentials), WordPress isn’t going to let you in to do an automatic update/upgrade.

    … unless I’m really missing something.

    Thread Starter blazerlocal

    (@blazerlocal)

    I have TWO web hosts – let’s call them webhost A and webhost B. They are described thusly:

    Webhost A:
    I have SSH/SFTP access but the ssh2 extension is not installed. I don’t have FTP access, either.

    Webhost B:
    I do not have an SSH account but the ssh2 extension is installed. I do, however, have an FTP account, but because WordPress doesn’t let you pick and chose which method you want to use, I can’t use it. WordPress is ONLY prompting me for SFTP information and I believe it should instead be asking you which method you want to use – not auto-detect it.

    Also, to quote from my earlier post:

    i have access to two different servers

    So, TWO web hosts and TWO different questions / complaints (one question / complaint for each of the two web hosts). I’ll confess that I wasn’t very clear on that in my first post and apologize for that…

    Now, I am fully capable of commenting out the appropriate lines to resolve the issue on webhost B, but I don’t believe I should have to. Certainly a good installer wouldn’t require it. And for webhost A… imho, WordPress should include a pure-PHP SFTP implementation. Just like it does for FTP. WordPress uses the ftp extension if it’s installed and it’s own implementation, otherwise. Why doesn’t it do that for SFTP?

    OHH!! I see a little more clearly now. It’s the absence of the SSH2 extension that is causing the distress. That now clarifies for me your statement about the pure php implementation for SSH…. in the absence … of the SSH2 extension on the server side. It makes more sense now. I appreciate your patience in elaborating. I would be interested in the answer to your question as well. I realize that’s of no help at all, but my gut tells me perhaps it could be intentional in its implementation to let non SSH2 connections fail simply because of the potential for cryptographic weaknesses in prior versions of the SSH protocol.

    I will confess that I avoid automatic upgrade of ANYTHING in my wordpress sites like the plague, but the only choices I have noted in the admin menu, are: Connection Type FTP,and FTPS (SSL) In that respect, you are on the money. It does not explicitly ask you for any other connection choice.

    Thanks again for your patience. I’ll keep any eye out for anyone that may be able to shed light on the question.

    Cj

    Thread Starter blazerlocal

    (@blazerlocal)

    Thinking about it… maybe moving this to the Requests and Feedback forum would be appropriate?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘annoying WP_filesystem limitations’ is closed to new replies.