Hot answers tagged

49

Accessing the contents (or more specifically file metadata except for filename) of a directory requires that the directory have the execute bit set. Your recursive chmod removed that permission, so you lost that access. If you are using the -R option of chmod is better to avoid using the numeric version of the permissions, and instead run (using your ...


22

I had the same issue and it seems that there is some bug in docker or overlay2 if directory content is created in one layer and its permissions are changed in other. As a workaround you could copy sources to temporary directory: COPY . /src And then move it to /var/www/html and setup permissions (in one RUN command): RUN rm -rf /var/www/html && ...


16

The dhparam file contains the prime which defines the group for the DH key exchange. It is not a secret, and will be sent in clear during the key exchange, so there is no point in trying to keep it secret. As for file permissions: nginx needs to read them, and an attacker must not be able to edit them. It may depend on your setup, but setting owner and ...


15

First, use the chgrp command instead of chown and that will work. In the case of using chown.....For security reasons in most Linux contexts, any ownership change is restricted to the root user eventhough you are marked as the owner of the file, directory, etc or not. In one case, this is to prevent users from evading quotas by setting the file permission ...


14

I ended up using file_open_mode=0777 local_umask=022 on the vsftpd.conf. The problem was that both FTP user and www-data user needed permissions to write, so i had to join www-data and ftpuser to www-data usergroup, and CHMOD -R 775 all the files on /var/www - that way, with 775 CHMOD, the group would have permission to read, write and execute. Now its ...


14

From the Wordpress documentation: If you have shell access to your server, you can change file permissions recursively by using the following commands: For Directories: find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} \; For Files: find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} \;


12

The nginx user is not able to traverse the filesystem to reach the folder where you have placed your site. A user must have the execute (+x) permission on a folder in order to be able to traverse it. From your permission information, drwx------ lamnk users lmank shows that only the directory's owner has the right to read, write, and execute on the folder. ...


10

Using rthomson's answer/command: find /path/to/hierarchy -type d | xargs chmod g+s It gave me problems when there are spaces in any of the sub-directories: Instead, I find just using the find -exec options much easier, i.e.: find /path/to/hierarchy -type d -exec chmod g+s {} \;


10

The --chmod argument syntax mentioned in the above is not quite accurate. When you specify owner, group, or other, and don't precede it with a "D" or a "F", it will apply that to all types of files, and it will apply the last parameter it finds as the default. This would explain why your directories were coming out as 744, since the last parameter in the ...


10

find / -type d -perm 777 -print


10

You can get rid of the find commands by using chmod's X flag: execute/search only if the file is a directory or already has execute permission for some user (X) This allows you to set the same permissions on files and directories, with directories additionally being executable, with a single command: $ chmod -R a+rX $dir


10

The Unix default permissions for a newly created file are 0666. The Unix default permissions for a newly created directory are 0777. If you do not want the default base permissions set an appropriate umask value. The only thing you can't easily do with umask is create a file which is by default executable (which, by simple common sense, is something you ...


10

Try adding : USER root It worked for me.


8

I found the answer : you have to use the option nounix together with file_mode and dir_mode Here is my fstab : //adsrv01/Photos /mnt/Photos cifs credentials=/root/credentials.txt,file_mode=0770,dir_mode=0770,nounix,uid=505,gid=505 0 0


8

Setting it to 1 sets the sticky bit. Setting it to octal 3 is actually setting octal 2, which is setting the setgid bit, and setting octal 1, the sticky bit. When the setgid bit is set on a directory all files (or directories) created in that directory will belong to the group that owns the directory. When the sticky bit is set only the owner and root can ...


8

Got my answer: As the www-data is the user responsible for the webserver and your normal user is responsible for the ftp server, you need first to make them both members of the same group: the group www-data. Creating custom User: useradd –d /var/www/asasd.com -g www-data -m yourusername this way the home directory will be the /var/www/asasd.com and your ...


8

The obvious problem is that /srv/git/test does not have the executable x bit set for owner and group. Thus it is not possible to traverse the directory. Resolve the issue with: chmod ug+x /srv/git/test


8

The default shell of RUN in Docker is /bin/sh and this is where the permissions not being set correctly actually has a problem. But you can change to just use /bin/bash instead to easily fix, notice before and after directory listing Step 7/9 : RUN /bin/bash -c 'ls -la; chmod +x gitlab-properties-builder.sh; ls -la' ---> Running in dc57ae77aa67 drwxr-...


7

Posix ACLs are the only clear-cut elegant way to do this, this is how I deal with shared read/write resource conflicts particularly on web-based systems. Here is a running example. In my example I have a directory called /var/www/html/share. In addition I have the users alice, bob, deploy and bower First, I have created a group called html and then added ...


6

I found that for my use case at least, using rsync to copy the directory onto itself was much faster than using chmod directly with a list of files from find. rsync -rpt --chmod=D770,F660 . . If you want to add a chown to the same operation, rsync lets you do that too with the --chown=user:group option.


6

See this question for why your system was hosed. This question duplicates Re-gaining root access to an EC2 EBS-boot image and all of this will only work for an EBS boot instance, not Instance Store boot, but to summarise: Stop (don't terminate) the server from the AWS console. Detach its root EBS volume. Start another ec2 instance in the same zone as the ...


6

Have you logged in again. Group membership is not normally reset once a user has logged in.


5

Solved: php-fpm doesn't run as the nginx user of course. It can be configured (in CentOS) in the file /etc/php-fpm.d/www.conf. I edited its config by adding line 45: 44 ;group = nobody 45 group = webadmin Then restarted it: sudo /etc/init.d/php-fpm restart


5

You could do the following (assumming Linux): cd $dir chmod -R a+r . find . -type d -print0 | xargs -0 chmod a+x This should be much faster than the combination of the two commands you indicated in your question.


5

I just had this happen to me this week when using --verbose. Was initially puzzled but think I have narrowed it down. This only happens when the SETGID bit is set. Test setup: $ mkdir --parent foo/bar Without SetGID, no error: $ chmod --recursive --changes o-rwx foo mode of ‘foo’ changed from 0775 (rwxrwxr-x) to 0770 (rwxrwx---) mode of ‘foo/bar’ changed ...


5

This issue is likely the result of a VOLUME definition inside the upstream Dockerfile. When a volume is defined in the Dockerfile, you can add files with a COPY or ADD command directly into the image. However, a RUN line will: Create a temporary container using the image definition as of the current point of the dockerfile That temporary container will ...


5

With Linux ACLs when adding users, you do not add them as owners of the file. It's just the privilege to open/modify and write to that file. When invoking chown or chmod the effective user ID will be e.g. jacob and that one will be matched against the value in owner. If that does not match, your command will fail. From man 2 chmod. The effective UID of ...


4

Adding --no-p disables just permissions setting, leaving all other options setup by -a intact. Another issue often happening is inability to set times this can be sorted by adding -O which you already have in your code


4

You have to be part of the group in order to be able to change the current group ownership to . You can edit /etc/groups file as root to make sure that user justin is a part of nginx group. After making changes for the group, you need to relogin to the system to make it in affect or to change to the group without a restart/logout, you can use cmd newgrp ...


Only top voted, non community-wiki answers of a minimum length are eligible