1828657 Members
8032 Online
109983 Solutions
New Discussion

Umask

 
SOLVED
Go to solution
Irene Jao
Occasional Advisor

Umask

I edited .profile of user01 to include umask 002.

All new directories created by user01 are now rwxrwxr-x

But all files are
rw-rw-r--

How do we make them also rwxrwxr-x

7 REPLIES 7
Thierry Poels_1
Honored Contributor

Re: Umask

Hi,

with umask set to 000 directories will be created as rwxrwxrwx, files will be created as rw-rw-rw-. Nothing you can do about, files will never be create with execute privilege!

You will have to add a chmod command if execute privilege is required.

regards,
Thierry Poels.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Bharat Katkar
Honored Contributor

Re: Umask

Hi,
Directory permissions are 777 and files are 666.
Now since defualt umask is 022 :
Default file permissions become 644 and directory permissions become 755 and then it will change accordingly with the umask value you set.

For umask 002 Files (664) and directory (775)
and so on.

Hope that helps.
regards,
Regards,
You need to know a lot to actually know how little you know
KapilRaj
Honored Contributor

Re: Umask

In the user's .profile add

alias mkdir=/home/script/mkdir.sh

Create /home/script/mkdir.sh as

mkdir $*
chmod 664 $*

Kaps
Nothing is impossible
Sanjay Kumar Suri
Honored Contributor

Re: Umask

The user can change the files created under a directory with the commnad chmod:

chmod 775 file_name

or

chmod -R 775 dir_name

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Irene Jao
Occasional Advisor

Re: Umask

unfortunately the files are created through a program to different directories. we have no way of knowing when to do chmod since they are created at different times and in different directories.
Sanjay Kumar Suri
Honored Contributor

Re: Umask

Files need +x permission if you want to execute them. Else for the purpose of read and write rw-rw-rw- with umask 000 should suffice.

If the need for x (execute) permission is still then a small script having chmod commands can be run periodically using cron.

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Jeroen Peereboom
Honored Contributor
Solution

Re: Umask

L.S.

Why do the files created by your program need the x-bit? Is the program generating other program-files, like shell scripts?

In stead of setting the x bit, you can also run the program by typing
sh filename

JP.