0

I have one requirement in which when I create a directory I want to create it with 777 permission. I did all stuff but not able to do this, anybody knows how to do this? Then please share.

Suppose I have directory /home/sachin/dir.

Now I am creating one folder test under /home/sachin/dir.

mkdir /home/sachin/dir/test

It will create test folder with 775 permission which I do not want.

I don't want to use -m option with the mkdir command.

7ochem
  • 191
sam
  • 11

1 Answers1

0

You have to use umask command:

Execute this command for creating every file or directory with 777 permission for an interactive shell:

umask 000

If you want to make it permanent setting for a single user then execute following commands:

gedit ~/.profile

and add a new line as

 umask 000 

then save the file.

If you want to make it default setting for all users, then execute following commands:

sudo -H gedit /etc/profile

and add a new line as

 umask 000 

then save the file.

muru
  • 197,895
  • 55
  • 485
  • 740
  • I want set umask for only test user then also i have add umask 000 into .profile file ? – sam Mar 04 '15 at 08:23
  • I added umask 000 into /home/test/.profile and save the file, after that i create a file and that file was created with 644 permission. Any idea how to resolve it. – sam Mar 04 '15 at 08:36
  • @sachin changes in ~/.profile require re-logging in to take effect. – muru Mar 04 '15 at 09:40
  • I did, I reboot the server but still file not create with 777 permission. – sam Mar 04 '15 at 11:39