• This morning I got this Idea. Hopefully this is the place to share it.

    Why WordPress don’t use the FTP user for the Theme Editor?. Using FTP user like on the installation of plugins, you will solve the problem of permissions for editing files with theme editor.

    I mean you have to put files and directory to 777 to edit the files with the theme editor.

    Also you can put your FTP settings on wp-config.php so you will no have to put the FTP password and user every time you save the file.

    The idea came to me when I was thinking on a client that wants to change de “about us”, with some cool HTML code and he knows a bit of HTML.

Viewing 15 replies - 1 through 15 (of 21 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    Not every server has FTP that can do that. Some people intentionally turn it off to prevent clients from auto-upgrading and breaking things.

    Thread Starter jaumesala

    (@jaumesala)

    If the server doesn’t have FTP, how you upload your theme files? Or how you install updates?

    Is an idea to solve the problem of setting 777 file permission to edit with theme editor.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    SSH mostly. Actually I have SFTP, but what I don’t have on my one server is the hood to let PHP use it. You can’t upload anything via the browser.

    Thread Starter jaumesala

    (@jaumesala)

    No offense man, but are you try to solve something?

    I’m not telling you that I have some error with wordpress

    I’m just giving an idea.

    I think Ipstenu was pointing out that there are reasons why this won’t be suitable for many sites and/or users. I’m assuming the idea was being mooted for discussion, yes?

    If so, can I add that a fair number of users have to enter their FTP credentials every time they update a plugin or WP itself (the reasons appear to be server config specific). Having to enter these same credentials for every single stylesheet amendment would be a right pain.

    [EDIT Moved the topic to Requests & Feedback since that seems a more logical home for it.]

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    That was my point, esmi, thanks πŸ™‚ I was trying to explain why, while it’s a nice idea, it would work for fewer people than the current situation (which surprisingly works for a higher number than I would have expected).

    I suppose they COULD put their FTP credentials in the wp-config.php file, esmi, but that would open a whole new security can-o-worms when (yeah, when) someone got hacked.

    Thread Starter jaumesala

    (@jaumesala)

    Ok fine.

    Hey guys,

    Many already put their SFTP credentials into their wp-config.php file in order to add/delete themes and plugins. What jaumesala is suggesting makes absolute sense–why give WordPress permissions to add a theme if it can’t then proceed to edit it?

    One of the main security issues I see is that WordPress accounts aren’t protected as well as SFTP accounts are by default (and are more subject to script attacks).

    It seems that use of the WordPress plugin Login Lockdown would go a good distance to resolving that problem.

    Additionally, if one’s server handles it, the connections WordPress is making are easily made tighter with SSH vs FTP:

    /** in wp-config.php */
    /** Force WordPress to use SSH method for plugins and themes */
    /** This eliminates the need to log in every time */
    define(‘FS_METHOD’, ‘ssh2’);
    define(‘FTP_SSL’, ‘true’);
    define(‘FTP_BASE’, ‘/home/SFTP-Account/wordpress/’);
    define(‘FTP_CONTENT_DIR’, ‘/home/SFTP-Account/wordpress/wp-content/’);
    define(‘FTP_PLUGIN_DIR ‘, ‘/home/SFTP-Account/wordpress/wp-content/plugins/’);
    define(‘FTP_USER’, ‘SFTP-login’);
    define(‘FTP_PASS’, ‘SFTP-password’);
    define(‘FTP_HOST’, ‘servername.com’);

    While not all servers have (S)FTP access, this would be a HUGE addition for those that do. This might seem small to an engineering type, but would be a game-changer for end users, which is the point.

    So all this to say +1 to using (S)FTP credentials to enable theme/plugin editor to “work”.

    Thread Starter jaumesala

    (@jaumesala)

    Hi hausinteractive,

    I really appreciate your vision on this matter. I really think that what I proposed is really a good idea.

    Not also solves theme editing, it also can be applied for the uploading of files. I mean that you will never have to setup a folder in 777 permissions if you use (S)FTP access and files will be written at the server for the appropriated user (the FTP user) no the apache user.

    Really thank you for you time everyone

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    Many already put their SFTP credentials into their wp-config.php file in order to add/delete themes and plugins.

    FWIW, I would never consider doing that, since if someone got access to my wp-config.php file via a backdoor on a plugin or theme, they’d have my server password. That mortifies me.

    I should clarify, since people seem to have gotten the wrong impression, that I think this is a great idea. But.

    It has not been proven to work for the majority of setups. In fact, given the recent kerfluffle with TimThumb, I would not be surprised if more and more hosts want to LOCK the themes and plugins folders down so they can’t be abused that way. The potential for security holes in that kind of change is daunting and needs to be deeply investigated.

    Thread Starter jaumesala

    (@jaumesala)

    I see.

    Hey Ipstenu,

    Thanks for the clarification.

    It sounds like everyone wants wordpress to be able to live up to it’s full potential (and have all of the admin options be available to as many people as possible)

    To that end, do you (or anyone reading this) know of any pages/wikis/docs that map out the different methods that people employ and their end result?

    While most people obviously have no control over their hosts, I would bet that many web developers would still be interested (because, you know, knowing is half the battle).

    Since I couldn’t find anything I put together a *super* incomplete (and possibly somewhat inaccurate) doc here:

    https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0AmG40U4O15VGdFI2RE1KR1lnamZXZWVMb0VTVUtDLVE&output=html

    …that is publicly editable here:

    https://docs.google.com/spreadsheet/ccc?key=0AmG40U4O15VGdFI2RE1KR1lnamZXZWVMb0VTVUtDLVE&hl=en_US#gid=0

    I created a patch for “hausinteractive” to version 3.2.1. It uses $wp_filesystem object to post the changed files for themes back to the server. This means that if filesystem permissions allow it it will make changes directly. Otherwise it will ask for upload method and credentials. If the information is already present in wp-config.php then it will be used.

    For those who are concerned that their WP accounts will be hacked then they can simply leave their upload credentials out of the wp-config and manually enter them every time an update or change is made.

    Here’s the patch:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    OK. Here’s the actual patch.

    Just to clarify: This is a patch file created with “diff”. It is meant to patch wp-admin/theme-editor.php. This will give the theme editor the ability to post changes back to the server via direct writes to the file system (if the web server has rights), FTP, SFTP and any other transfer method that WP supports.

    To install use the “download” link to download the file. Upload it to your host. Login with a shell account. And use the following commands:

    $ cd {wordpress}/wp-admin
    $ patch -b theme-editor.php {patch}

    I’m assuming a *nix hosting environment. I don’t work in windows environment so If your hosted on windows someone else will need to provide instructions. The ‘$’ at the beginning of the lines are their to illustrate the *nix prompt. Don’t type them. Replace “{wordpress}” with the folder name of your WP install. Replace “{patch}” with the full path to the patch file you uploaded.

    Its possible to make similar alterations to other editors like plugin-editor.php to allow more control from the WP control panel.

    *WARNING* As has already been brought out in this discussion with the application of this patch and your upload credentials in the wp-config.php file its possible for anyone who gains access to your account to make alterations to WP. However this isn’t really any worse than downloading a poisoned theme or plugin. Personally I think downloading plugins and themes can be more dangerous. You’ve been warned.

    Thread Starter jaumesala

    (@jaumesala)

    Sorry but it’s hard to me to undertand what are you proposing.

    For exemple the patch command is a unix command? What this command is for?

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘[Idea] Why you don't use FTP user for Theme Editor, like on installation of plug’ is closed to new replies.