Questions tagged [chmod]
A Unix tool for changing file permissions
247
questions
270
votes
2
answers
86k
views
Why is "chmod -R 777 /" destructive?
This is a Canonical Question about File Permission and Why 777 is "destructive".
I'm not asking how to fix this problem, as there are a ton of references of that already on Server Fault (reinstall OS)...
76
votes
7
answers
148k
views
How to setup linux permissions for the WWW folder?
Updated Summary
The /var/www directory is owned by root:root which means that no one can use it and it's entirely useless. Since we all want a web server that actually works (and no-one should be ...
55
votes
1
answer
45k
views
What does the @ symbol mean in a file's permission settings?
I'm on MacOSX, I did ln -s on a directory and these are the results:
-rwxrwxr-x@ 1 shiki admin 970332 Mar 6 16:38 apc.so
-rwxrwxr-x@ 1 shiki admin 653884 Mar 6 16:38 eaccelerator.so
-rw-rw-r--...
32
votes
1
answer
7k
views
Which permissions should I set to dhparam.pem?
I am generating Diffie-Hellman parameters for the ssl_dhparam directive in the SSL configuration of nginx.
The file dhparam.pem is created with the command openssl dhparam 2048 -check -out dhparam....
30
votes
5
answers
179k
views
chmod not working correctly in Docker
I'm building a Docker image for my Symfony app and I need to give permission to apache server to write into cache and log folders
#Dockerfile
FROM php:7-apache
RUN apt-get update \
&& apt-...
22
votes
2
answers
2k
views
chmod -R makes files in child folders ureadable for some reason
I was adjusting the permissions when setting up some WordPress themes, and ran chmod 664 -R theme-dir/* It worked fine on the files in the root of the directory, but all the files in subdirectories ...
19
votes
2
answers
39k
views
How to set file/folder permissions using Rsync from Windows to Linux
I want to transfer lots of files/folders from Windows to Linux using Rsync. On linux server(destination), I want the file permission set to 644, and folder permission set to 755. If possible, I want ...
17
votes
5
answers
14k
views
CHMOD - Applying Different Permissions For Files vs. Directories
I've been trying to clean up permissions on a few boxes and have been scouring the chmod man as well as all the internet documentation that I an handle without any luck -- so here we go.
Basically, I'...
16
votes
5
answers
69k
views
vsFTPd default uploaded file permissions on Ubuntu not working
I have a Server running Ubuntu 12.10 x64, and the last version of vsFTPd.
My user example.com has its home folder set on /var/www/example.com,
I created a public_html folder inside and gave 777 ...
16
votes
4
answers
14k
views
How do I copy ACLs on Mac OS X?
Most unix derivates can copy ACLs from one file to another with:
getfacl filename1 | setfacl -f - filename2
Unfortunately Mac OS X does not have the getfacl and setfacl commands, as they have rolled ...
13
votes
1
answer
57k
views
Nginx doesn't have permission to access files with the same ownership
i've just installed nginx on an Archlinux box and encounter this problem:
Nginx is configured to run as "nginx", a new user/group that I added, in /etc/nginx/nginx.conf:
user nginx nginx;
For ...
12
votes
9
answers
159k
views
Is there a way to run chmod on Windows
Is there a way to run the chmod command on Windows?
12
votes
2
answers
41k
views
rsync - failed to set permission - operation not permitted
I got the following command with this error
rsync -avz --links -O /home/jansiatest/.jenkins/workspace/svn_to_demo/trunk/CPS/ [email protected]:/home/tasklite/temp
sending incremental file ...
11
votes
2
answers
81k
views
Using chown to change the group owner of a directory is not permitted....Why?
I am trying to execute chown on a directory that has the following permissions and owners:
drwxrwxr-x 2 justin devs 4096 Jan 1 20:42 test
I am trying to simply execute the following as the justin ...
11
votes
3
answers
17k
views
How to allow members of a group to change file permissions on linux
I need to allow members of the group 'ftpusers' to be able to change permissions on all objects inside a certain directory. I was looking into how to do it but all I have found is how to do it on BSD:
...
10
votes
4
answers
5k
views
Can a file that is executable be read?
If a file has permissions -rwx-wx-wx can it be read by other and group users, or can it only executed and written? Is there some way to read an executable file by executing it?
8
votes
3
answers
34k
views
Change all file permissions to 644 and all folder permissions to 755 recursively
How to change all file permissions to 644 and all folder permissions to 755 recursively using chmod in the following two situation:
If they had 777 permissions
Regardless of the permission (with ANY ...
7
votes
4
answers
6k
views
Make recursive chmod faster
I have an installation script that unzips a directory, then recursively chmods its contents.
I'm surprised it takes almost 10 times the time it takes to unzip, to run the following two commands:
...
7
votes
4
answers
15k
views
Change group ownership of Folders with chmod g+s
I have a folder hierarchy that I want to change the group ownership including any subsequent file/folder additions. I was going to use chmod g+s but I'm not sure if it applies to already created ...
7
votes
2
answers
16k
views
Why would chmod give "No such file or directory" when running recursively?
I can change the permissions of the file directly:
# chmod --changes --recursive ug+rwX /var/www/shared/tmp/cache/assets/BA0/280/sprockets%2F286302903364106648b609d708884f78
and I can also ...
7
votes
2
answers
12k
views
Still confused by Permissions - linux, nginx, php-fpm
I have read the canonical answer at What permissions should my website files/folders have on a Linux webserver?
However I'm still stuck. My setup is:
A developer user 'ade' who owns the directories ...
6
votes
6
answers
3k
views
Correct recursive chmod, separate for files & dirs
I'd like to recursively chmod a directory so that:
Files are 0664
Directories are 0775
How to do it better, shorter, fancier? :) Maybe, use umask somehow?
All find solutions are too long: I always ...
6
votes
2
answers
4k
views
What exactly does this dpkg command do?
I fixed a permissin problem for nagios like discribed here.
The command was:
sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
sudo dpkg-statoverride --update --add ...
6
votes
3
answers
9k
views
chmod all files (including hidden files) in a directory in Linux (not recursively)
Yesterday I did something stupid which I today realised. I ran:
/root# chmod o-rwx * .*
This supposed to remove read, write and execute permissions for the world on all files in the current ...
6
votes
1
answer
21k
views
chmod 1777 or 3777 on /tmp
Is there an ideal chmod for /tmp (with /var/tmp symlinked to /tmp)?
I've seen people mention it both ways just curious as to the difference.
Is it a security difference?
6
votes
4
answers
4k
views
Making Apache able to write to PHP files with PHP running as DSO?
I have PHP running as a DSO. As such, my installer script (which writes to a config file) can't do any writing.
How do I give apache (user: nobody) the ability to write to the file?
5
votes
5
answers
20k
views
is it safe to chmod 775/664 with owner www-data:www-data?
To make working with my webserver easiest I am proposing doing something like the following:
sudo chown www-data:www-data /var/www -R
cd /var/www
sudo find . -type f -exec chmod 664 {} \;
sudo find . ...
5
votes
3
answers
11k
views
Apache "No Permission" - 403 forbidden
I've accidentally performed a wrong chown update this morning and now my /var/www permissions are all wrong.
I'm unable to access anything anymore, apache will always say I do not have permission to ...
4
votes
3
answers
30k
views
chmod -R 777 / on ubuntu - numerous problems
A client has accidentally given the entire filesystem full permissions on their ubuntu 10.04 box.
chmod -R 777 httpdocs/cd /
As you can see they attempted to cd to the root, and instead gave chmod a ...
4
votes
4
answers
2k
views
How to restore remote access to a RHEL system from expanded permissions set over the entire filesystem? [duplicate]
Cause of the problem
I intended to add group write permission on hidden files like '.hgignore' with the following:
# pwd
/opt
# sudo chmod -R g+w .*
The problem is that '..' matched this pattern, ...
4
votes
4
answers
11k
views
Allow PHP to write file without 777
I am setting up a simple website on webspace provided by my university. I do not have database access so I am storing all the data in a flat file. The issue I am experiencing is related to file ...
4
votes
4
answers
4k
views
Why is it so important to remove 777 permissions?
I'm writing installer for my PHP web app. It requires user to change permissions of a few files and directories (config.php, cache, uploads, .htaccess) to 777 (so that it's writable). I've seen in ...
4
votes
2
answers
325
views
Accidential CHMOD 755
Alright, I accidentially chomdded everything to 755, which isn't as terrible as chowning everything to the local user. How insecure is this and how would I restore it easily, without reinstalling?
4
votes
1
answer
34k
views
Is CHMOD 775 safe to use?
I know it's not good to use CHMOD 777, but is 775 as dangerous? Does it provide a backdoor to hackers as easily as 777?
4
votes
3
answers
28k
views
CHMOD To Prevent Deletion Of File Directory
I have some hosting on a Linux server and I have a few folders that I don't ever want to delete. There are sub folders within these that I do want to delete.
How do I set the CHMOD permissions on the ...
4
votes
2
answers
20k
views
Is chmod 700 on a directory sufficient to prevent arbitrary access to subdirectories?
If I chmod 700 the the home directory of a user (on Linux), does this guarantee that other non-privileged users cannot access any subdirectory or file under that home directory? Or are there sneaky ...
4
votes
2
answers
11k
views
what chmod and owner:group settings are best for a web application?
we are configuring a PHP web application on CentOS and have all our files currently in /var/www/html/project/
Apache is configured to run as apache:apache and has access to the directory above. Right ...
4
votes
2
answers
5k
views
SaltStack: How to work around "file.recurse doesn't preserve permissions"?
How to work around Recursive directory management doesn't preserve permissions?
I want to copy all files in (local) /monitoring/files/etc to /etc on the minion.
copy_files_in_etc:
file.recurse:
...
4
votes
1
answer
5k
views
Only allow a user to CHMOD and CHOWN in their home directory or a specified directory
I have a Windows user on my network who has Samba access to our linux development server. Occasionally permissions or ownership will become confused for reasons unknown and he will no longer be able ...
4
votes
3
answers
7k
views
Conflicts between ACLs and umask
I have a directory which can be read and written by a couple of unix groups. This is achieved by using ACLs. Let's assume I did it like this:
mkdir /tmp/test
setfacl -d -m g:group1:rwx /tmp/test
...
4
votes
2
answers
5k
views
Linux ACL behaviour: settings the mask changes 'ls' output, but not actual permissions
It might be the time of night, but this is puzzling me. Picture the following.
[root@node1 acltest]# getfacl foo/
# file: foo
# owner: root
# group: testuser
user::rwx
group::r-x
other::---
[root@...
4
votes
1
answer
3k
views
Undoing chmod 777
Sometimes in desperation, to test if my problem is not the permission problem I do:
sudo chmod -R 777 mydir/
In most cases it does not helps, and now I have two problems ;)
Files inside mydir/ had ...
4
votes
1
answer
2k
views
Permission Hierarchy possible in OpenSolaris + ZFS + ACLs?
I've been doing some research into OpenSolaris and ZFS for use in a NAS.
Thus far I have created the following:
/tank/projects
/tank/storage
/tank/developer
/tank/sandbox
The ...
4
votes
1
answer
1k
views
chmod -R 777 on PXE server - why
So I am following a guide to set up a PXE server, for reference here are the links:
Actual PXE setup
NFS PXE setup
Live-cd PXE setup:
Now throughout these guides he keeps running the chmod -R 777 &...
4
votes
2
answers
3k
views
setfacl equivalent to chmod for setting/unsetting individual flag
Using setfacl command line arguments, is there a way to set/unset a single flag as the following command will do ?
chmod g+x FILE
Please note that:
setfacl g::x FILE
setfacl g::--x FILE
are ...
4
votes
1
answer
6k
views
File permission mask/mode settings for Samba on FreeNAS?
I'm currently working on the Samba settings on a FreeNAS server. When any user creates a file or a folder on the server I want the file or folder to get the following RWX permissions:
Folders: ...
3
votes
3
answers
558
views
Maintain setgid bit (after bower install or gulp build)
We run web servers where we have the following situation:
The www-data user runs the web server and must have read+write access to the files
The deploy user deploys all the code
The bob and alice ...
3
votes
2
answers
22k
views
How to set permissions for a CIFS mount with autofs?
I've set up a CIFS mount on my CentOS 6.4 server with autofs :
File /etc/auto.mnt :
Photos -fstype=cifs,perm,rw,uid=505,forceuid,gid=505,forcegid,file_mode=0770,dir_mode=0770,credentials=/root/...
3
votes
3
answers
2k
views
Cross-group file permissions in Linux
I have 2 users: Alice and Bob and 2 groups: Management and Personnel. Alice has primary group Management, and secondary groups Personnel and Alice. Bob has primary group Personnel and secondary group ...
3
votes
3
answers
2k
views
Alternative to having directories with 777 permissions
I am running several websites on my dedicated server and a lot of my sites require that some directories have permissions set to 777. I know this is a major security issue, and I also know it's ...