I have a question.
Server: VPS
System: Centos 6 + Plesk 11
save_mode = off;
Problem:
I have a script that creates folders for users.
mkdir('/var/www/vhosts/website.com/private/'.$user_id.', 0755, true);
And true the Plesk API i create a ftp user for the new folder.
The problem is that my php script create the new whit the following group and user: apache(502)/503
The ftp users has no rights in this folder at all.
If i create folders true ftp the group and user are: 505/10000
It is because your PHP script is running in mod_php mode and executes under Apache user. The easiest solution would be to switch your site to run in FastCGI mode, so that PHP script is running under your PHP user and there is no ownership conflict.
The question is pretty old, but I found a solution so thought it might be helpful for someone.
Following commands needs to be executed using root access.
cd /var/www/vhosts/yourdomain.com
chown -R youruser:psacln httpdocs
chmod -R g+w httpdocs/wp-content
find httpdocs -type d -exec chmod g+s {} \;
For details explanation you can view the link
http://www.ryanbelanger.com/wordpress-file-permissions/
Related
I'm trying to save a file called app.js on a folder called js.
Vs Code pop up this:
Failed to save 'app.js': Unable to write file 'vscode-remote://wsl+ubuntu-18.04/js/app.js'
(NoPermissions (FileSystemError): Error: EACCES: permission denied, mkdir '/js')
I tried:
sudo chown -R user /mnt/c/Users/myUser/Documents/myFolder/proyectFolder
but I still can't save this file.
Try this, fixed it for me
sudo chown -R username path
Example:
sudo chown -R emanuel /home/emanuel/test/
In the SSH terminal:
Recommended :
sudo chmod -R 777 folder_name_where_your_file_exists
or
sudo chmod -R 755 folder_name_where_your_file_exists
this works for me
sudo chown -R $USER:$USER /home/
TLDR;
If you're using a docker container, avoid making files from within the container because the owner and group permissions may cause problems with your editor (in my case VS Code)
I was running docker container for a Django project from Windows Terminal and using VS Code to edit my code.
It is a Linux file (since everything in Linux is a file) permission problem that arises because the files don't have proper user and/or group permissions. So VS Code tries to tell us that.
The problem I found only happened when I created files from within my docker container.
I would run docker exec ... bash
make new files using touch /path/to/file from the container bash
then try to edit those files on VS Code (say urls.py) only to get the scary permissions error preventing the file from saving.
I suspect that making files from within the container embellishes those files with different owner and group settings than your system would default to if you just ran the commands locally (not in the container).
Changing the file permissions with chown -hR and chgrp -hR would do the trick but to avoid the error altogether I stopped making files from within the container.
Try activating polling:
This worked for me during I tried using wsl.
The below is for individual file:
sudo chown yourUserNAme filename
For an entire directory it will be (when you write ls to terminal, you should see your directory to execute this command):
sudo chown yourUserNAme dirName
For recursive (i.e files and folders inside a folder):
sudo chown -R yourUserNAme dirName
Note: yourUserNAme is, if you do pwd under any Documents, you will see the path: /home/jhon/Documents. Here user is jhon.
Run VS Code as administrator and it will fix the problem.
https://answers.microsoft.com/en-us/windows/forum/all/error-in-vs-code-destination-directory-and-says/e70dc626-6b12-4791-a960-8b704e57098d
Install the extension Save as Root in Remote SSH in VS code.
While saving press Ctrl + Shift + P.
This open the command palette.
Search Save as Root
It is a Linux user permissions problem.
you should use the command:
sudo chown -R $USER:$USER.
I'm symlinking my config/unicorn_init.sh to /etc/init.d/unicorn_project with:
sudo ln -nfs config/unicorn_init.sh /etc/init.d/unicorn_<project>
Afterwards, when I run chkconfig --list my unicorn_ script doesn't show. I'm adding my unicorn script to load my application on server load.
Obviously, this is not allowing me to add my script with:
chkconfig unicorn_<project> on
Any help / advice would be awesome :).
Edit:
Also, when I'm in /etc/init.d/ and run:
sudo service unicorn_project start
It says: "unrecognized service"
I figured this out. There were two things wrong with what I was doing:
1) You have to make sure your unicorn script can play nice with chkconfig by adding the below code below #!/bin/bash. Props to digitalocean's blog for the help.
# chkconfig: 2345 95 20
# description: Controls Unicorn sinatra server
# processname: unicorn
2) I was attempting to symlink the config/unicorn_init.sh file when I was already in the project directory which was creating a dangling symlink (pink colored symlink ~> should be teal) by using a relative path. To fix this, I removed the dangling symlink and provided the absolute path to the unicorn_init.sh file.
To debug this I used ll in the /etc/init.d/ directory to see r,w,x permissions and file types, was running chkconfig --list to see a list of services in /etc/init.d/ and also was trying to run the dangling symlink in my /etc/init.d directory with sudo service unicorn_<project> restart
Hope this helps someone.
I have been trying to install Homebrew on my Mac but ran into permission problems since my user is not an administrator.
I followed the suggestions here: https://stackoverflow.com/a/16450503/4909923
su -l admin
sudo chown -R "$USER":admin /usr/local
sudo chown -R $USER:admin /Library/Caches/Homebrew
Now I'm concerned that I have wrongfully changed the ownership of these folders to a specific user. Will it impact my normal user negatively?
changing ownership of /usr/local to a specific user is not a solution. It is a terrible hack and a workaround if you have a single user system. But then you might as well just chown -R / $USER:$USER – fijiaaron Jan 23
If this was a stupid thing to do, how do I restore it to normal?
It should probably look like the image with /lib/ which is another folder in /usr/, with system Read & Write and wheel Read Only.
It should probably look like this (another folder in /usr/):
I think the permissions I mentioned in the comment should be fine, but if you want to be sure everything is set at its default, you can uninstall Homebrew using this script and then reinstall it from scratch.
You can also follow this advice for resetting the permissions.
I have a Zend Framework application. Almost all of my urls work fine. However, any url that starts with /resources gives me a 403 forbidden error (e.g.: /resources/add, /resources/edit). The strange thing is, when I tested it on my Windows machine via XAMP, everything worked fine. Is there something special about urls starting with /resources that makes Apache2 think it should not allow access?
Your issue seems a permissions problem, nothing related to URLs. Check directories to be 755 and files 644 in the Ubuntu server where you deployed your application.
Run this in the root directory of your application and should get you going:
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
We are moving web servers. (LAMP)
Webserver 1 has hundreds of symbolic links pointing to files in a different directory (eg. ../../files/001.png). When we move over to the new server (have downloaded the site to my computer then reuploading to Webserver 2 using SFTP client Transmit). It does not copy the symbolic links...
Is there a better way to get the symbolic links from one server to another apart from recreating them on the new server?
rsync -a from one server to another will preserve file attributes and symlinks.
rsync -av user#server:/path/to/source user#server2:/path/to/target
Something like the following? On Webserver 1:
tar czf - the_directory | (ssh Webserver2 "cd /path/to/wherever && tar xzf -")
This creates a tar of the stuff to copy to STDOUT, and pipes it to an untar on the other server over ssh. It can be faster than a recursive ssh copy too.