

How do I use absolute mode?Ībsolute mode is one of two ways of specifying permissions. We need to discuss absolute mode and symbolic mode. Here are two examples of manipulating permissions for file2: # chmod 740 file2īut wait! Those appear to be radically different examples (they're not, actually). The syntax is straight-forward: chmod permissions resource-name The change mode or chmod command sets permissions. Without the -R option, you would only affect the Resources directory itself, but not its contents. Effectively, recursive means "this and everything in it." In the above example, you are configuring the related user/group for the Resources directory and everything in it. Technically, recursive commands are repeated on each specified object. The above task provides a recursive configuration. How do I change the user/group for a directory and all of its contents? # chown -R user01:groupA Resources So how do I use chgrp? # chgrp groupB file1 There is a specific chgrp command, but I prefer only to memorize one command ( chown) and apply it to both functions (user and group associations) rather than chown for the user and then have to recall chgrp for the group.

How do I change the owner and group at the same time for file2? # chown user02:groupA file2 How do I change the group associated with file1? # chown :groupA file1 How do I change the user/owner associated with file1? # chown user02 file1 The group association is also that user's primary group. You can see that the user account that created the resources also owns those resources. The long format contains both permissions and ownership. The ls -l command displays directory contents in long format. How do I display permission, owners, and groups? # ls -l In the playground directory, display the current owner and group associated with the Resources directory and the files. How do I create several files at once? # touch file2 file3 file4 How do I manage ownership and groups? How do I create a file named file1? # touch file1 The -p option creates parent directories as needed to complete the path. Note: The goal here is to create the 2020data directory, but the given path's data directory does not yet exist.
#NETATALK USER PERMISSIONS WHEN WRITING SERIES#
How do I create a directory path (a series of directories that don't yet exist)? # mkdir -p Resources/data/2020data How do I create a directory named Resources? # mkdir Resources The touch command is one of many ways to create files. Use the mkdir command to create directories. Use rm -fR /playground, userdel user01, and groupdel groupA to remove the resources. When you've completed the article and learned the techniques I've covered, delete the two user accounts, the groups, and the playground directory. You are ready to work with the commands and concepts below. In your home directory, create a new directory named playground: # mkdir playgroundĬhange into the ~/playground directory by using the cd command. Note: You would use the passwd user01 command to set the user's password. Note that you do not need to configure passwords for the users in this exercise, as you won't log on with those accounts. It's best to do this on a virtual machine rather than your personal Linux box, but these tasks are relatively harmless.Ĭreate two new users and two new groups to work with.

You can use the following commands to set up a playground. With that in mind, I'll assume you have a couple of identities and resources to experiment with as you read the rest of the article. That means that the things that I write are usually structured as some sort of lab or other hands-on opportunity. I've been in IT for about 25 years, and most of that time was spent as a technical trainer. 8 tech tips to advance security and compliance.
