Changing file properties and Permissions

Source: Internet
Author: User

First, change the user belongs to the group

1. Create a new file Install.log

[email protected] ~]# Touch Install.log

2. Ls-l View Install.log file belongs to group root

[Email protected] ~]# ls-l
Total 4
-RW-------. 1 root root 1978 Dec 01:26 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 Dec 02:38 Install.log

3, chgrp the Instal.logl file belongs to the group changed to become users

[Email protected] ~]# CHGRP users Install.log
[Email protected] ~]# ls-l
Total 4
-RW-------. 1 root root 1978 Dec 01:26 anaconda-ks.cfg
-rw-r--r--. 1 root users 0 Dec 02:38 Install.log

4, chgrp the Instal.logl file belongs to the group to change back to root

[Email protected] ~]# ls-l
Total 4
-RW-------. 1 root root 1978 Dec 01:26 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 Dec 02:38 Install.log

Ii. changing the owner of the file

1. View Install.log's file owner

[Email protected] ~]# ls-l
Total 4
-RW-------. 1 root root 1978 Dec 01:26 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 Dec 02:38 Install.log

2, Chown Change the owner of the Install.log file is bin

[Email protected] ~]# Chown bin Install.log
[Email protected] ~]# ls-l
Total 4
-RW-------. 1 root root 1978 Dec 01:26 anaconda-ks.cfg
-rw-r--r--. 1 bin root 0 Dec 02:38 Install.log

3. Chown change back to Install.log file owner as root

[Email protected] ~]# chown root Install.log
[Email protected] ~]# ls-l
Total 4
-RW-------. 1 root root 1978 Dec 01:26 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 Dec 02:38 Install.log

Third, change the permissions of the file

R:4

W:2

X:1

Owner=4+2+1=7;group=4+2+1=7;others=0+0+0=0

770

1. View Install.log Permissions

[Email protected] ~]# Ls-al Install.log
-rw-r--r--. 1 root root 0 Dec 02:38 Install.log

The-rw-r--r--file has a permission of 644, the file owner has a readable executable, the file belongs to the group has the readable permission, the other user has the readable permission.

2, change the authority of Install.log to 777

[Email protected] ~]# chmod 777 Install.log
[Email protected] ~]# Ls-al Install.log
-rwxrwxrwx. 1 root root 0 Dec 02:38 Install.log

3, change the authority of Install.log back to 644

[Email protected] ~]# chmod 644 Install.log
[Email protected] ~]# Ls-al Install.log
-rw-r--r--. 1 root root 0 Dec 02:38 Install.log

Iv. permissions of the group to which the file belongs

Owner=u

Group=g

Other=o

A=all r+w+x

1. View Install.log Permissions

[Email protected] ~]# Ls-al Install.log
-rw-r--r--. 1 root root 0 Dec 02:38 Install.log

2. Change the Install.log authority to 777

[Email protected] ~]# chmod u=rwx,go=rwx Install.log
[Email protected] ~]# Ls-al Install.log
-rwxrwxrwx. 1 root root 0 Dec 02:38 Install.log

3, change the authority of Install.log back to 644

[Email protected] ~]# chmod u=rw,go=r Install.log
[Email protected] ~]# Ls-al Install.log
-rw-r--r--. 1 root root 0 Dec 02:38 Install.log

4. Change the Install.log authority to 755

[Email protected] ~]# Ls-al Install.log
-rwxr-xr-x. 1 root root 0 Dec 02:38 Install.log

Changing file properties and Permissions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.