User Tools

Site Tools


opus:fall2012:dsherbur:unixpart3

unix Keyword 3

Identification of chosen keyword: umask

Definition of umask

The command umask is used to determine file modes at creation. Using umask on a file will determine the permissions of that file and all child processes resulting from that file. umask was used on Super Puzzle Box 2 Turbo (vim setup.exe). Where chmod changes permissions on a file, umask sets the initial permissions. In Super Puzzle Box 2 Turbo (the best Puzzle Box this side of the Danube), when the datafile is created, umask is used to set permissions to (octal) 777, ensuring that permissions will not be an issue when working with the file.

lab46:~$ umask u=rwx,g=,o=
lab46:~$ mkdir goop; cd goop
lab46:~/goop$ touch trees
lab46:~/goop$ mkdir pain
lab46:~/goop$ ls -l
total 0
drwx------ 2 dsherbur lab46 6 Nov 14 15:19 pain
-rw------- 1 dsherbur lab46 0 Nov 14 15:18 trees

Setting the umask values to what would be octal 700, which gives all permissions to the user and owner and no permissions to group or other, I have made private files. Changing umask again changes the permissions of newly created files.

lab46:~$ umask u=rwx,g=rwx,o=rwx
lab46:~$ cd goop
lab46:~/goop$ ls -l
total 0
drwx------ 2 dsherbur lab46 6 Nov 14 15:19 pain
-rw------- 1 dsherbur lab46 0 Nov 14 15:18 trees
lab46:~/goop$ touch park
lab46:~/goop$ ls -l
total 0
drwx------ 2 dsherbur lab46 6 Nov 14 15:19 pain
-rw-rw-rw- 1 dsherbur lab46 0 Nov 14 15:22 park
-rw------- 1 dsherbur lab46 0 Nov 14 15:18 trees

Note the difference in the umask line from the first block to the second block. We can use this to prank people who leave their terminals open by setting the umask vales to 0 across the board, making files that they create themselves unaccessible. However, umask can be changed and the files created under the permissionless umask and be changed via chmod to be accessible.

lab46:~/goop$ umask u=,g=,o=
lab46:~/goop$ touch jello
touch: setting times of `jello': Permission denied
lab46:~/goop$ ls -l
total 0
---------- 1 dsherbur lab46 0 Nov 14 15:26 jello
drwx------ 2 dsherbur lab46 6 Nov 14 15:19 pain
-rw-rw-rw- 1 dsherbur lab46 0 Nov 14 15:22 park
-rw------- 1 dsherbur lab46 0 Nov 14 15:18 trees
lab46:~/goop$ vim jello
lab46:~/goop$ chmod 777 jello; ls -l
total 0
-rwxrwxrwx 1 dsherbur lab46 0 Nov 14 15:26 jello
drwx------ 2 dsherbur lab46 6 Nov 14 15:19 pain
-rw-rw-rw- 1 dsherbur lab46 0 Nov 14 15:22 park
-rw------- 1 dsherbur lab46 0 Nov 14 15:18 trees

When I vim'd jello, i was greeted with a permission denied screen and I was unable to modify or write to the file, verifying the initial permissions of the file.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

unix Keyword 3 Phase 2

whiptail/dialog

Definition

Whiptail and dialog are used to make interactive dialog boxes from shell scripts. A good example of these programs at work is GIMMEH. It is important to note that a command line interface is not always the best solution. Sometimes, information is better presented in a more graphical manner, even though the mouse is still mostly vestigial.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

Demonstration

Demonstration of the indicated keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 
opus/fall2012/dsherbur/unixpart3.txt · Last modified: 2012/11/30 23:29 by dsherbur