Saturday, July 22, 2017

centos - 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/credentials.txt ://adsrv01/Photos



What a ls command shows :



[root@websrv01 mnt]# ls -l
total 4
drwxr-xr-x 1 root root 4096 Apr 26 12:01 Photos


What I expect from the ls command :




[root@websrv01 mnt]# ls -l
total 4
drwxrwx--- 1 photos photos 4096 Apr 26 12:01 Photos


Do you see anything wrong ? How can I set owner and chmod right ?



Edit : I forgot to say that chown and chmod commands are denied for root user on the /mnt/Photos directory. I can't get it right, and I also tried using fstab.



This is what happens with fstab :




mkdir /mnt/Photos
chmod 770 /mnt/Photos
chown photos:photos /mnt/Photos
mount /mnt/Photos


The permissions are automatically changed and set to 755 when the directory is mounted. I can't set the mode back to 770 : permission denied.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...