Managing Owners and Groups

team bbl


Permissions to your files are given to the owner, the group, or all accounts. You may want to transfer a file you created to another owner. More often, you want to change the group for a file as a way of allowing specific users to access it.

On many systems, when a file is created, the group for the file is the same name as the owner who created it. For instance, a file created by janet may belong to the janet group. If you give permissions on the file to other accounts by adding them to the janet group, you allow them access to all files you create. A better solution is to create a new group, add the members you want to be able to access the file to the new group, and change the group for the file. Then, if you give write permission to the group for the file, all group members (but not all accounts) have write permission.

On some systems, the group for a user account is one general group that includes all user accounts. You need to set your permissions on your file with that in mind. To limit the access to your file, you can change the group.

You can change the owner or group of a file at the command line using one of the following commands that change the owner and group of file2:

 chown salesmanager file2    (changes owner to account salesmanager) chgrp sales file2          (changes group to sales) 

If you are in the Konqueror file manager, you can use the Run Command item in the Tools menu to quickly execute a single command. Or open a terminal window with Tools->Open Terminal.

A group must exist before you can give it ownership of a file. Creating groups is done using the User and Groups utility discussed in Chapter 8. To create a group on Fedora, select main menu->System Settings->Users and Groups to get the window in Figure 8-2. Click Add Group. Type the new group name in the dialog box. Click OK. Or create a group, much more quickly, at the command line by typing:

 groupadd groupname 

To add an account to a group, in the Users and Groups window, highlight an account and click the Group tab. Check the box by a group name to add the account to the group. Or use the command-line command:

 usermod -G groupname username    (notice the uppercase G) 

The account you use to change owners and groups must have the power to change them. If you see a message like "Operation not permitted," the account can't make the change you entered. Changing to the root account (su root) solves the problem.

    team bbl



    Spring Into Linux
    Spring Into Linux
    ISBN: 0131853546
    EAN: 2147483647
    Year: 2005
    Pages: 362
    Authors: Janet Valade

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net