Change file is 7.2 group tools chgrp; syntax: chgrp [parameter options] ...
Group file ... It's users and chown is similar, except that it only be used to change the file or directory belongs to the Group;-R parameter is used for directory and directory all files changed in the case of group. This and the same is true of the chown. Simple to two examples; example: root @ localhost ~] # ls-lsun.txt-rw-r-r-1rootroot004-2509: 38sun.txt root @ localhost ~] # chgrpbeinansun.txt note: changing the case of groups as sun.txt beinan user group; root @ localhost ~] # ls-lsun.txt-rw-r-r-1rootbeinan004-2509: 38sun.txt example 2: root @ localhost ~] # ls-ldmydir/drwxr-xr-x2rootroot409604-2509: 08mydir/root @ localhost ~] # ls-lrmydir/total 8-rwxr-xr-x2rootroot2904-2221: 02sun.txt-rwxr-xr-x2rootroot2904-2221: 02sun002.txt lrwxrwxrwx1rootroot704-2122: 16sun001.txt-> sun.txt-rw-r-r-1rootroot004-2422: 37example.txt-rw-rw-rw-1rootroot004-2415: 05dony.txt root @ localhost ~] # chgrp-Rlinuxsirmydir/Note: change the mydir and following all the files and subdirectories for be group as root @ localhost linuxsir; ~] # ls-ldmydir/drwxr-xr-x2rootlinuxsir409604-2509: 08mydir/root @ localhost ~] # ls-lrmydir/total 8-rwxr-xr-x2rootlinuxsir2904-2221: 02sun.txt-rwxr-xr-x2rootlinuxsir2904-2221: 02sun002.txt lrwxrwxrwx1rootlinuxsir704-2122: 16sun001.txt-> sun.txt-rw-r-r-1rootlinuxsir004-2422: 37example.txt-rw-rw-rw-1rootlinuxsir004-2415: 05dony.txt 7.3 file owner and group of special circumstances; root @ localhost ~] # ls-lhsungood.txt-rw-r-r-15015028504-2513: 45sungood.txt above example is a bit strange because his owner and group is a numeric value; this is why? the reason for this is that the system does not exist and the corresponding user, so only in digital form. Sometimes we delete a user, but does not delete its home directory, in this case, it's home directory owner and group also becomes digital; root @ localhost ~] # userdellinuxsir root @ localhost ~] # ls-ld/home/linuxsir drwx — 16501502409603-2702: 28/home/linuxsir 8, effects files read-write execution factors; the reason to this part of the contents of a single column, because this part of the content is based on our user management and file permissions on the basis of understanding. For example, a file for read, write, execute, it will be what kind of impact. A file can be read, is affected by its owner, in the case of groups and other user rights, but also by its parent directory permissions. Let's take for example; root @ localhost ~] # cd/home Note: Enter/home directory; root @ localhost home] # mkdirredhatdir Note: create a directory redhatdir root @ localhost home] # touchredhatdir/test.txt note: create a file test.txt root @ localhost home] # chmod700redhatdir/Note: to modify the permissions for redhatdir owner can read and write executable, in the case of groups, and other users without permission; root @ localhost home] # ls-ldredhatdir/Note: to view the properties of the redhatdir; drwx — 2rootroot409604-2513: 01redhatdir/root @ localhost home] # ls-lrredhatdir/Note: to view the properties of the test.txt file; total 0-rW-r-r-1rootroot004-2513: 02test.txt root @ localhost home] # subeinan Note: we switch to the normal user beinan beinan @ localhost home] $ cdredhatdir/Note: to enter the beinan redhatdir directory to user identity. Bash: cd: redhatdir/: permission isn't enough beinan @ localhost home] $ moreredhatdir/test.txt redhatdir/test.txt: permissions are not sufficient to explain: we look at by this example test.txt in the other, why power users have read permissions on the r-, but we use ordinary users cannot view its contents? this is because his parent directory has no other users what read permissions. We are not the other user redhatdir directory can read permission to open, you can let ordinary users can read the beinan test.txt content it localhost root @ home??] # chmod704redhatdir/root @ localhost home] # ls-ldredhatdir/drwx--r--2rootroot409604-2513: 02redhatdir root @ localhost home] # subeinan beinan @ localhost home] $ cdredhatdir/bash: cd: redhatdir/: insufficient rights seems to be if you do not set permissions on a group, just open the owner's permission and other users in the directory permissions of reading redhatdir, other users cannot access; we should put the test.txt parent directory redhatdir's owner of read, write, do you want to open, but also to the parent directory is set to read and execute permissions to other users of the open, read and execute permissions to open, also is to have the permissions so that the file rwxr-xr-x other users can access. Root @ localhost # chmod755redhatdir/home] root @ localhost home] # moreredhatdir/test.txt as if this wasn't clear enough, if you do not quite understand, practice exercises, chmod nor difficult. Assign permissions for the file actually ended up making file owner what permissions to allow a group of users what permissions that allow other users what permissions. File permissions and user management associated, so understanding which also have to understand the user management. 9, the file is modified or accessed; root @ localhost ~] # ls-ladduml02.s-rwxr-xr-x1rootroot54504-2122: 26adduml02.s us by viewing the file properties, will find it time markers, such as the above 04-2122: 26. This does not mean that the file is created, he represents the file being accessed or modified time. File modified time is better understood, for example, we can use the editor to modify a text file, and then save this file. Of course there are other tools that do not modify the contents of the file, only the modified files, can be called the access time. For example, touch tools to achieve this objective. Root @ localhost ~] # ls-ladduml02.s-rwxr-xr-x1rootroot54504-2122: 26adduml02.s root @ localhost ~] # touchadduml02.sh Note: updated file access time of the current system time; root @ localhost ~] # ls-ladduml02.s-rwxr-xr-x1rootroot54504-2511: 21adduml02.s usage on touch, more see: mantouch or touch — elp 10, file attributes and file system properties; file system characteristics determine file attributes define and modify, as we pass the chattr to lock a file is not modifiable or not delete, with chattr + I parameter; this in ext2 and ext3 file system is effective, but reiserfs file system does not have any effect; root @ localhost ~] # chattr + ilsfile.s root @ localhost ~] # lsattrlsfile.s----i--------lsfile.s root @ localhost ~] # rm-rflsfile.s rm: cannot remove "lsfile.sh": not permitted operations Note: If you can modify the lsfile.sh become can be deleted, you should use the-I parameter; for example in ext3 or ext2 file system, we want to make a file only append content, but cannot be deleted. Should use the chattr + a parameter. If you use the ext3 file system, see help with chattr, manchattr. previous
No comments:
Post a Comment