Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

additional digit is the first one; it is explained later in this chapter, in the
section “Understanding Set User ID, Set Group ID, and Sticky Bit
Permissions.”


To change the umask setting—for example, if you wanted the default to be
740 —use the following:


Click here to view code image
matthew@seymour:~$ umask 037


File Permissions with chgrp


You can use the chgrp command to change the group to which a file


belongs:


Click here to view code image
matthew@seymour:~$ chgrp wheel filename


Changing File Permissions with chown


You can use the chown command to change the owner of a file:


Click here to view code image
matthew@seymour:~$ chown matthew filename


You can also use the chown command to change the group of a file at the
same time:


Click here to view code image
matthew@seymour:~$ chown matthew:wheel filename


Understanding Set User ID, Set Group ID, and


Sticky Bit Permissions


The first two of the three listed types of permission are “set user ID,” known
as suid, and “set group ID,” or sgid. These settings, when used in a program,
enable any user running that program to have program owner or group owner
permissions for that program. These settings enable the program to be run
effectively by anyone, without requiring that each user’s permissions be
altered to include specific permissions for that program.


One commonly used program with suid permissions is the passwd
command:

Free download pdf