How can this be accomplished?

You are the administrator for a group of shell script developers. They use vi, and have asked you
to make their scripts automatically executable when they save their files.
How can this be accomplished?

You are the administrator for a group of shell script developers. They use vi, and have asked you
to make their scripts automatically executable when they save their files.
How can this be accomplished?

A.
Enter set �o vi on the command line, or include it in each user’s startup script.

B.
Enter umask �s on the command line, or include it in each user’s startup script.

C.
Enter umask 000 on the command line, or include it in each user’s startup script.

D.
Enter umask 777 on the command line, or include it in each user’s startup script.

E.
It is not possible to automatically set the execute bit on with the umask setting, or vi option.

F.
Enter umask 766 the command line, or include it in the global startup script for the default shell.

Explanation:
Unlike DOS, which uses the file extension to determine if a file is executable or not,
UNIX relies on file permissions.
The value assigned by umask is subtracted from the default.
User’s file creation mask. umask sets an environment variable which automatically sets file
permissions on newly created files. i.e. it will set the shell process’s file creation mask to mode.
umask 000 would grant full permissions.
Note: 777 full permissions



Leave a Reply 10

Your email address will not be published. Required fields are marked *


Richie

Richie

-rw-rw-rw- 1 root root 0 Oct 16 11:33 umask_0000
-rw-rw-r– 1 root root 0 Oct 16 11:31 umask_0002
-rw–w—- 1 root root 0 Oct 16 11:35 umask_0146
-r–r–rw- 1 root root 0 Oct 16 11:34 umask_0220
–w——- 1 root root 0 Oct 16 11:35 umask_0467
—-r–r– 1 root root 0 Oct 16 11:31 umask_0722
———- 1 root root 0 Oct 16 11:32 umask_0777

Marek

Marek

This is because default mode for file creation is 666, so when we use umask 000, we get file with permission 666. I think answer C is incorrect.

lamba lamba ghughnt pht

lamba lamba ghughnt pht

e is correct

david

david

drwxrwxrwx 2 root root 2 Apr 4 12:41 1111
-rw-rw-rw- 1 root root 16 Apr 4 12:40 1111.sh

pls be noted that file is 666 and dir is 777 when umask be assigned to 0000.

Armen

Armen

Don’t agree. The dir will also have 666

Rashad

Rashad

Dirs by default are executable. Because they are dir. When umask is 0000. Default creation of dirs will be 666+111(x)=777

Armen

Armen

E is correct.

ah

ah

E

You cannot add with umask, only substract. Dont mess with people