I've got a strange problem. After creating an application (CakePHP v2.4.9) I've deployed it to virtual server online. It wasn't working so I went through some steps:
chown -R user:group, chmod -R 775, checked for BOM, checked for mod_rewrite etc.
I've tried complete new application on server, same steps and nothing. Only after chmod -R 755, everything worked out.
Now, on a shared server, chmod -R 775 works great. What could cause this behavior? As far I can tell, 755 are less permissions than 775. Even chmod -R 777 wasn't the solution, only 755 was.
Virtual server PHP version: 5.4.27
Shared server PHP version: 4.4.9
Some servers are configured to not run files with permissions that are too open. Especially on shared hosting.
Related
In order to get WordPress updates and other functions of WP-ADMIN to work, I ran the following command to "fix" file persmissions.
sudo chown -R daemon:daemon /your-path-to-wordpress
This worked for the admin functionality, but now I am unable upload any files via ftp with user "bitnami". I can connect but not do anything else. How do I fix this to allow both WordPress admin updates to function and keep FTP access?
I run bash script file through python code. The script is located /home/myscript.sh. The script convert html to pdf and print. If I run the python program in development mode it works fine but if I run in WSGI production mode it give me error "File not found" to print. But if I give access 7777 to home directory it works fine. And I need to do this access step every time whenever machine restarted. Also it not good solution.
I search a lot and change apache2.conf file
<Directory /home/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
But still there is problem. Please help me. I used Apache 2.4.9 version. Advance thanks
Update
In /etc/apache2/apache2.conf file
"User ${APACHE_RUN_USER}" and "Group ${APACHE_RUN_GROUP}"
And in envvars it sets like
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
Still problem exist.
If issue is with directory
Example /home
Move the file from /home to /var/www
sudo chown www-data:www-data /var/www/filename
or
sudo chown www-data:www-data /var/www/filename
If the issue with USB port
Example
ttyUSB0
,
ttyACM0
,
ttyACM1
Write script to change the owner
#!/bin/bash
sudo chown www-data:www-data /dev/ttyACM0
Call this script from your code using subprocess.call
But allow the user www-data to run this file as sudo with out password
sudo visudo
and add the below line in the last
www-data ALL = (ALL) NOPASSWD : /var/www/filename
or
www-data ALL = (ALL) NOPASSWD : ALL
I have set up Vagrant (ubuntu/trusty64) on Mac and it's working perfectly except the fact I just cannot change directory permissions.
I have CakePHP project running in /var/www/[projectName] which is also the default www-directory.
Now, CakePHP cache engine needs access to /var/www/[projectname]/app/tmp/cache but the user:group is set to vagrant:vagrant. I try to change it with sudo chown -R vagrant:www-data [path] but it just doesn't change. It always stays as vagrant - vagrant when I need it to be vagrant - www-data.
Chmod works (setting for example from 775 to 777).
Any ideas why I cannot change permissions?
You can use synced folders
config.vm.synced_folder ".", "/var/www",
owner: "vagrant",
group: "www-data",
mount_options: ["dmode=775,fmode=777"]
Here there a good example
I've used PuPHPet to configure a Vagrant VM (box: puphpet/debian75-x64) for use with CakePHP.
I vagrant ssh into the vm, and go to /var/www/example.dev/app/, and from that folder I try to run Console/cake.
Result => -bash: Console/cake: Permission denied.
I've tried chmod 777-ing just about everything, but to no avail.
What do I need to do to make the cake command work?
I had the same problem, after doing this(so making it executable) it worked
chmod +x app/Console/cake
edit: you will need root access to do so
I am trying to configure apache2 with cgi (python). For that, I have to change permissions of some folders and files but I am getting sudo fatal errors every time I try to change permission of a file or a Folder.
For Example:
1
j#ubuntu:/etc/apache2$ ls
apache2.conf envvars magic mods-enabled sites-available
conf.d httpd.conf mods-available ports.conf sites-enabled
j#ubuntu:/etc/apache2$ sudo chmod 777 httpd.conf
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins
...................................................................................
2
j#ubuntu:/usr/lib/cgi-bin$ sudo /etc/init.d/apache2 restart
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins
...................................................................................
3
j#ubuntu:/usr/lib$ sudo chmod -R 777 /usr/lib/cgi-bin
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins
...................................................................................
Note:
j#ubuntu:/etc/apache2$ ls -l /usr/lib/sudo/sudoers.so
-rwxrwxrwx 1 root root 177452 Jan 31 2012 /usr/lib/sudo/sudoers.so
Any help would be highly appreciated !
If you have docker installed on your host, you can leverage its permission vulnerabilities on volumes to solve this issue.
Run
docker run -it -v /usr/lib/sudo:/tmp ubuntu:xenial
Once inside the container, being the root user there, you can:
cd /tmp
chown root sudoers.so or chmod 644 sudoers.so depending on the exact issue
It's not a really clean solution but it solves the issue.
You have to login to root shell to resolve this sudoers.so permission issue. If you have root account login, directly login to root shell otherwise search something like "How do I boot into a root shell" or "Drop to root shell prompt". If you use Ubuntu you can follow this link https://askubuntu.com/questions/92556/how-do-i-boot-into-a-root-shell.
Once you are in root shell change the permission of the file /usr/lib/sudo/sudoers.so to
#chmod 644 /usr/lib/sudo/sudoers.so
for OSX, there is diskutil command to repair disk permissions:
diskutil resetUserPermissions / `id -u`
it will take a while :( ... you might first try to open script editor, create new script and execute:
do shell script "chown -R root /usr/local/libexec/sudo/sudoers.so" with administrator privileges
if that does not work, the repairpermission should do the trick.
Please try to login as a root user and change the file permission for the directory as
chmod 700 /usr/lib/sudo/sudoers.so then it will solve your problem.
It worked for me!
Try this:
pkexec chmod go-w /usr/lib/sudo/sudoers.so