Monday, 2 December 2013

UNIX Group Commands

Group Commands

1) chgrp - group file change the group of the file

chgrp [options] 

2) chown- owner file change the ownership of a file.

chown [options]  - can only be done by the superuser

3) chmod - change file permissions
The command to change permissions on an item (file, directory, etc) is chmod (change mode). The syntax involves using the command with three digits (representing the user (owner, u) permissions,the group (g) permissions, and other (o) user's permissions) followed by the argument (which may
be a file name or list of files and directories). Or by using symbolic representation for the permissions and who they apply to.

chmod [who]op[perm] [argument list]
--- No access is allowed
r-- Read-only access
r-x Read and execute access, for programs and shell scripts
rw- Read and write access, for files
rwx All access allowed, for programs
Interpretation of the following few examples should help:
-rw------- 1 taylor 3843 Oct 10 16:22 iecc.list
-rw-rw-r-- 1 taylor 280232 Oct 10 16:22 mailing.lists
-rw-rw---- 1 taylor 1031 Oct 7 15:44 newlists
-rwxr-x--- 1 taylor 64 Oct 9 09:31 the.script
The first file, iecc.list, has read and write permission for the owner (taylor) and is off-limits
to all other users. The file mailing.lists offers similar access to the file owner (taylor) and
to the group but offers read-only access to everyone else on the system. The third file,
newlists, provides read and write access to both the file owner and group, but no access to
anyone not in the group.
The fourth file on the list, the.script, is a program that can be run by both the owner and
group members, read (or copied) by both the owner and group, and written (altered) by the
owner. In practice, this probably would be a shell script, as described earlier, and these
permissions would enable the owner (taylor) to use an editor to modify the commands
therein. Other members of the group could read and use the shell script but would be denied
access to change it.

4) chown - change ownership
Ownership of a file can be changed with the chown command. On most versions of Unix this can only be done by the super-user, i.e. a normal user can’t give away ownership of their files. chown is used as below, where # represents the shell prompt for the super-user:
Syntax
chown [options] user[:group] file

No comments:

Post a Comment