0

Hi I have a directory /home/nvs-upload/media/ImageFtp/ and the directory ImageFTP have many sub directory. The issue than I have is than a job run and add new sub directory it add to the new directory the permission 755 and the files inside 644. I will like to add automatically to the new directory and files the permission 777. not matter the user or group.

what command I have to run to do this action?

2

You can set directories to 777 and files to 666, respectively, by defining default values as ACL entries:

setfacl -m default:u::rwx -m default:g::rwx -m default:o::rwx /home/nvs-upload/media/ImageFtp

(use the -R option to recursively also apply this to already existing files and directories). Here we set the default values for the user, group and others to rwx.

Please note that you:

a) have to have the drive mounted with ACLs enabled (on standard UNIX FSs these are mostly activated by default these days) and

b) you cannot make files executable by default as explained here and the discussions linked there.

  • I use the long versions of parameters for low-rep users nowadays, (--recursive) but +1 anyway as I was going to say the exact same thing! ;-) – Fabby Oct 24 '18 at 22:59
  • Excellent it work Good. – Angel Oct 25 '18 at 18:23
  • But In linux of amazon show me Operation not supported. It was work on Centos 7. who I can do to set it on Amazon Linux AMI? – Angel Oct 25 '18 at 21:58
  • @Angel Sorry, I am not familiar with this flavour. Try using using the output of mount to see what filesystem you are using and then check in /proc/fs/<repective filesystem>/<partition>/options for an acl entry. If none is given you might be able to remount with the acl option - given that the FS supports it. – Fiximan Oct 27 '18 at 12:39
0

If you wish change permission for your files and folders recursively, you need use command chmod with -R: sudo chmod -R 777 your_folder/ In this case directory your_folder and all files and subdirectorys it includes will get permissions 777.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.