User jack makes use of the bash shell; his home directory is/export/home/jack.
What is the correct setting of umask, and where should it be set, to allow jack to create a shell script using the
vi editor, that is executable by default?
A.
It is not possible to make a script executable without using the chmod command.
B.
umask value of 0002 set in /etc/profile
C.
umask value of 0002 set in /export/home/jack/.bashrc
D.
umask value of 0722 set in /etc/profile
E.
umask value of 0722 set In /export/home/jack/.bashrc
Explanation:
The user file-creation mode mask (umask) is use to determine the file permission for newly created files. It can
be used to control the default file permission for new files. It is a four-digit octal number.
You can setup umask in /etc/bashrc or /etc/profile file for all users. By default most Unix distro set it to 0022
(022) or 0002 (002).
1. The default umask 002 used for normal user. With this mask default directory permissions are 775 and
default file permissions are 664.
2. The default umask for the root user is 022 result into default directory permissions are 755 and default file
permissions are 644.
3. For directories, the base permissions are (rwxrwxrwx) 0777 and for files they are 0666 (rw-rw-rw).
In short,
1. A umask of 022 allows only you to write data, but anyone can read data.
2. A umask of 077 is good for a completely private system. No other user can read or write your data if umask
is set to 077.
3. A umask of 002 is good when you share data with other users in the same group. Members of your group
can create and modify data files; those outside your group can read data file, but cannot modify it. Set your
umask to 007 to completely exclude users who are not group members.
I think it should be A, you can not give executable permission to a file without chmod command.