How can I fix (or avoid) owners/permissions issues?
ANSWER: In short, try not to overuse SFTP for file editing or web design, and use the WordPress interface instead as much as possible. If SFTP is necessary, however, and you notice permissions issues, kindly wait up to one hour and the issues should resolve themselves due to the hourly cron jobs that all our servers run which reset all file ownership and permissions.
More detail: File ownership and permissions issues are one of the more common issues that “true” VPS servers face, which of course includes LittleBizzy clients. But wait, what does this mean exactly? Because slimmed-down Nginx servers do not install bulky cPanel or similar applications to manage users and files (instead using the built-in SSH/SFTP access methods) and also because of potential over-use of SFTP and reliance on SFTP, sometimes the permissions of a given file can be temporarily “tweaked” during the upload/edit process that happens over SFTP.
Because of our minimalistic setup focused on speed, we do not install an “extra” FTP app to our servers but rather offer SFTP access via the Ubuntu/Nginx stack directly. This means that our team manually creates a special user “example” and group “wordpress” for each VPS server, and adds the Nginx user “www-data” into the “wordpress” group as well. To avoid all owners/permissions issues 100% without fail, always use the WordPress admin panel for any uploads, updates, or customizations. Installing themes, plugins, or hacking files via SFTP is rather poor practice unless migrating a site, and comes with various risks, especially on an “optmized” setup like ours that does not have bulky cPanel (etc) to manage all server owners/permissions. We kindly ask our users to get more comfortable using the WordPress admin as it continues to evolve rapidly and can take care of 99% of your needs rather than relying on SFTP access out of laziness or “because I’m used to it” :)
Early 2016 update: we now run cron jobs every single hour (hourly) to reset permissions on every server. This means if you experience permissions issues or SFTP errors, kindly wait up to 1 hour and these issues should disappear. Most hosts don’t reset permissions more than once a day, so this is already pretty often. To avoid the issues, kindly try to not use SFTP when you are doing file editing. Lastly, if you have waited 1-2 hours and the issues persist, please let us know and we can check in the (very) rare case that your server’s cron jobs are not firing properly. Cheers!
====
Sometimes during the course of tweaking your WordPress files via SFTP, or due to a misbehaving plugin, the owners/permissions of a file or directory can be misconfigured. In fact, this isn’t a “misconfiguration” per se as much as its simply your “server” user (i.e. www-data) trying to take care of business at the same time as your SFTP user (i.e. example). While a file or folder gets its “owner” or “group” changed, this means that occassionally your SFTP user (or server user) won’t be able to edit or execute a certain file. Likewise, when the Unix permissions (i.e. 777) get tweaked, a similar situation can occur where a plugin can’t access or edit a certain file properly.
To deal with this situation, some web hosting companies run very bulky software like cPanel or otherwise to monitor and control all files on a server. Other companies offer a “permissions reset” button on your control panel where you can manually request the permissions and owner/group to be totally reset across your entire website (server).
Here at LittleBizzy we have come up with a tiny shell script for Ubuntu that runs every single minute (or less, if needed) to automatically reset the owners, groups, and permissions on your entire WordPress website (and beyond). All owners/groups will be reset to your USERNAME:GROUPNAME and recommended permissions will be reset to 664 for files and 775 for directories as officially recommended by the WordPress team.
This is a free service offered by LittleBizzy that we now include on all new accounts. If you have issue with this service kindly let us know and we can either enable, disable, or adjust the script as needed for your case. Cheers!