ExpressionEngine on Vagrant VM: "Thumbnail could not be created for the image" error - linux

We're running ExpressionEngine 2.6.1 on a Vagrant VM (CentOS 6.2), with the EE files in the Vagrant "shared folder". When I ssh into the Vagrant machine, I see the following permissions for the uploads folder and its children:
uploads: drwxrxrwx apache apache
uploads/_thumbs: drwxr-xr-x apache apache
We changed the ownership of those directories to the apache user and group just to see if that's what EE needed, but with no success. Previous to that we had:
uploads: drwxrwxrwx vagrant apache
uploads/_thumbs: drwxrwxrwx vagrant apache
and before that:
uploads: drwxrwxrwx vagrant vagrant
uploads/_thumbs: drwxrwxrwx vagrant vagrant
And in all three cases, when we try to upload an image to a content item, we get the following error:
Thumbnail could not be created for the image. Please make sure the thumbnail directory is writable.
Does anybody have any ideas why this would be the case?

What user and group do you need to be? The default user after you ssh is vagrant:vagrant.
chown -R user:group uploads
That will recursively chown all of the files and directories in uploads. Maybe that helps.

When we tried to reproduce the problem on a second computer running the exact same repo and exact same Vagrant set up, the problem disappeared. When we deleted the entire repo from the first computer and re-cloned, the problem went away as well.
Not a great answer, I know, but that's all I've got.

Related

I can SSH as root into LEMP centos on VULTR, but I can't sftp for the life of me

I tried the exact same thing with an Ubuntu LEMP, and had no issue sftp as root.
I deployed a one-click CENTOS 6 LEMP with Vultr. I can SSH into it fine, but the root credentials don't work to stfp into it. It just times out.
I've tried creating a new user with root access, added to wheel and even tried adding to visudo - with this used I can sftp ok, but when I navigate to...
/usr/share/ngix/html/
... to create folders and upload static websites pages - I get permission error.
All I want to do here is this really, host simple static website.
Why can't I sftp as root?
What am I missing here?
SFTP as root typically requires you to be able to SSH as root. It is common (and good security practice) for the default sshd configs to not allow root login.
Check your sshd configs.

chmod fails to alter permissions in Vagrant VM

I am trying to set up a Vagrant environment to host Snowplow (https://github.com/snowplow). When I launch vagrant from a cygwin shell
$vagrant up && vagrant ssh
I get into an Ubuntu guest image (12.04), and when I attempt to install java8 into this environment using ansible, I get this message:
vagrant#precise64:~$ ansible-playbook
/vagrant/ansible-playbooks/java8-gradle.yml
--inventory-file=/vagrant/home/ansible/ansible_hosts --connection=local ERROR: The file /vagrant/home/ansible/ansible_hosts is marked as executable, but failed to execute correctly. If this is
not supposed to be an executable script, correct this with chmod -x
/vagrant/home/ansible/ansible_hosts.
The file is indeed 777:
-rwxrwxrwx 1 vagrant vagrant 24 Mar 3 19:03 ansible_hosts*
but this same file is sync'd to the host (Windows) and cygwin shows the file as 644:
-rw-r--r-- 1 rcoe Domain Users 24 Mar 3 14:03 ansible_hosts
Is there a known issue running in a headless (VirtualBox) Vagrant environment that doesn't allow permissions to be set on files that are sync'd to the host?
Thanks.
It is a known deficiency, but reportedly not a bug: Changing shared folder permissions from within virtual machine
There is a good tutorial on how to set up the synced folder in vagrant so that it would suit your needs - if you navigate to that link it will show the following snippet
config.vm.synced_folder "./", "/var/sites/dev.query-auth", id: "vagrant-root",
owner: "vagrant",
group: "www-data",
mount_options: ["dmode=775,fmode=664"]
that shows how to adjust the permissions of the synced folder.
Alternatively you could also use a different method of syncing the folder, such as rsync (keeping in mind what the trade-offs are)
config.vm.synced_folder "/Users/ryansechrest/Projects/Sites", "/var/www/domains",
type: "rsync"
More on that here

GitLab data folder on samba share

I need some help configuring a samba share as gitlab data folder.
I've tried following suggestions here:
change the data directory gitlab to store repos elsewhere
and the official documentation to no avail.
Here is what I did:
1] I've installed gitlab 7.6.2 using the omnibus package and I've also checked that everything worked using the preconfigured /var/opt/gitlab/git-data folder
2] I've mounted my samba share (located on a nas server) on /media/gitlab-data by modifying my /etc/fstab file.
Here is the fstab line:
//xxx.xxx.x.xx/test /media/gitlab-data cifs username=xxx,password=xxx 0 0
the user I'm using to connect has full permissions on the share.
After the mount operation the permissions on that folder are the following:
Initial permissions
3] I've modified the configuration of gitlab in /etc/gitlab/gitlab.rb changing the gitlab_user_data parameter to
/media/gitlab-data
I've then proceeded with a
sudo gitlab-ctl reconfigure
At the end of the reconfigure script the privileges of my share are:
Permissions after reconfigure
and the initial gitlab-satellites and repositories folder have been created succesfull.
Now, the gitlab web interface is fully operational but I'm unable to create a new project (or add a new user). As soon as I click 'Create project' the web interface returns with the following error:
Failed to create repository
I'm quite sure it is a permission problem but I don't know how to solve this.
I also add 2 strange things:
1] I wasn't able to find any error inside the logs related to this operation. The only related message I see is inside the gitlab-shell log:
I, [2015-01-13T14:27:50.408394 #1658] INFO -- : Adding project root/test.git at .
2] The test.git folder inside /media/gitlab-data is indeeed created but, doing an ls -la on my mounted folder returns this permissions:
drwxrwxrwx 3 1024 users 0 Jan 13 14:27 .
drwxrwxrwx 3 git git 0 Jan 13 14:27 ..
drwxrwxrwx 7 1024 users 0 Jan 13 14:27 test.git
Probably something is trying to make a chown on these folder and that command ultimately fails.
I also don't know who is the owner of this 1024 uid.
Any help is appreciated.
Thanks in advance!
This is because it cannot create a symlink to the file:
/opt/gitlab/embedded/lib/ruby/2.1.0/fileutils.rb:355:in `symlink': Operation not supported # sys_fail2 - (/opt/gitlab/embedded/service/gitlab-shell/hooks, /<path>/gitlab/git-data/repositories/root/repo.git/hooks) (Errno::EOPNOTSUPP)
from /opt/gitlab/embedded/lib/ruby/2.1.0/fileutils.rb:355:in `block in ln_s'
from /opt/gitlab/embedded/lib/ruby/2.1.0/fileutils.rb:1595:in `fu_each_src_dest0'
from /opt/gitlab/embedded/lib/ruby/2.1.0/fileutils.rb:353:in `ln_s'
from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_projects.rb:28:in `create_hooks'
from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_projects.rb:99:in `add_project'
from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_projects.rb:48:in `exec'
from /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-projects:31:in `<main>'
I just commented out line 28 in /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_projects.rb and was then able to create the project.

Wordpress: media library uploader (localhost) cannot upload files

I am on a KUbuntu 12.04 with Apache2, MySQL, PHP, vsftpd setup.
I have installed WordPress 3.8.1 for local (testing) purposes and everything seems to working fine expect the Media Uploader (both flash and browser).
When I try to upload an image or a PDF file, it stucks on Crunching... and never continues from this point, although the file is uploaded to "uploads" folder.
When I click on Dashboard -> Media -> Library, the file is there but when I try to insert it in a post or page the library is empty.
My settings are:
I did usermod -a -G www-data myusername
I've changed ownership and group recursively to www folder and subfolders and files with 755 permissions.
Apache2 (/etc/apache2/envvars)
APACHE_RUN_USER= myusername
APACHE_RUN_GROUP=www-data
tried everything here: username:usergroup, www-data:www-data (the default) with no success.
How can I fix this?
Thank you
Did you chmod the uploads directory?
chmod 777 uploads

Newly created folder permission rights issue

Hope you are good. I have Xammp on fedora and changed owner of opp/lampp/htdoc to root. Why I did so because whenever someone creates new folder through sharing, they don't have permission to dynamically create folder or files or to write images. Then I run command
chmod -R 777 /opt/lampp/htdocs
But when system goes to restart then I again need to run this command. So avoid again and again run this command I changed the owner on "opt/lampp/htdocs" and run
chmod -R 777 /opt/lampp/htdocs
Now, whenever server restarts, assigned permissions don't need to be set again and again. That is resolved.
I have an issue, that old directories can be used to write something. But if any network user creates new directory under htdocs, that new directory needs to be changed the permission for it.
previously created, and can use this one directory to run script to create files
drwxrwxrwx 2 root root 4096 2011-06-15 14:09 aaa
Newly created, cannot be used to run a script to create image or to write anything
drwxr-xr-x 2 root root 4096 2011-06-17 15:17 aaaa
drwxr-xr-x this one is really annoying to me for each newly created folder in htdocs :(
Just to let you know that my htdocs user and rights are:
drwxrwxrwx 101 root root 4096 2011-06-17 15:17 htdocs
Why is it so? Can anybody please help me to figure this problem out? I am waiting for quick response anxiously.
First off, you should investigate what permissions you really need - chmodding everything to 777 is a security risk as it will allow any user to write inside of your web root.
However, to address your actual question of the default permissions when a new folder is created by a user, you want to adjust the default "umask" which determines such things.
This question has some information for changing it for the Apache user (if a "network user" is a user creating new files and directories through the httpd process):
Setting the umask of the Apache user
If you need to adjust it for other users or processes, the solution will be similar.
Good luck!
Edit
Since you're on Fedora, try this: (from the question I linked above)
[root ~]$ echo "umask 002" >> /etc/sysconfig/httpd
[root ~]$ service httpd restart
The first command will add that line to the /etc/sysconfig/httpd which is a permanent configuration file, and the second command will make it active.
You are tackling the problem from the wrong side. Restore your apache configuration to use apache.apache as default user/group, and set your samba server to use those credentials when someone write to your document root.
If you are using nfs or another posix compatible filesystem, use chmod g+s to keep all files readable from your apache server.
Try it:
#umask 000
have a good time!!

Resources