Preface Before we begin, we should briefly understand the file attributes and how to change file attributes: From the above picture we can see some basic properties of the file, including permissions, number of links, owner and group, file size, modification time, file name, etc. Change directory
View the file list
ls -lh converts the byte display of the file size into the familiar Windows ls -lhd /etc is to view the size of the etc directory instead of viewing all the contents under the ect directory. #ls -i View the id number of each file Permission Flags
Permission Grouping Example - rw-r--r-- 1 root root 48 Jan 8 20:14 token.txt The first 10 digits -rw-rw-r--
From the above explanation, we can see that the permissions of the token.txt file are: The current user itself: readable and writable, no executable permission Current user group: readable but not writable, no executable permission Other users: Readable but not writable, no executable permission rwx can also be replaced by numbers
Permissions correspond to numbers, octal
Modify file permissions chmod 777 file|dir (-R recurse into subfolders) [root@iZwz9id7ajv83jhb9gicj0Z spiders]# chmod 777 test_data/ -R [root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls batj_kb.py batj_yb.py __init__.py items.py sztj_tjkb.py sztj_tjyb.py test_data batj_kb.pyc batj_yb.pyc __init__.pyc items.pyc sztj_tjkb.pyc sztj_tjyb.pyc [root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls -l total 60 -rw-r--r-- 1 spiderftp ftp 2484 Sep 19 17:07 batj_kb.py -rw-r--r-- 1 spiderftp ftp 2806 Sep 19 17:07 batj_kb.pyc -rw-r--r-- 1 spiderftp ftp 4751 Sep 19 17:07 batj_yb.py -rw-r--r-- 1 spiderftp ftp 4801 Sep 19 17:07 batj_yb.pyc -rw-r--r-- 1 spiderftp ftp 161 Sep 19 17:07 __init__.py -rw-r--r-- 1 spiderftp ftp 132 Sep 19 17:07 __init__.pyc -rw-r--r-- 1 spiderftp ftp 512 Sep 19 17:07 items.py -rw-r--r-- 1 spiderftp ftp 606 Sep 19 17:07 items.pyc -rw-r--r-- 1 spiderftp ftp 3900 Sep 19 17:07 sztj_tjkb.py -rw-r--r-- 1 spiderftp ftp 3542 Sep 19 17:07 sztj_tjkb.pyc -rw-r--r-- 1 spiderftp ftp 1522 Sep 19 17:07 sztj_tjyb.py -rw-r--r-- 1 spiderftp ftp 2046 Sep 19 17:07 sztj_tjyb.pyc drwxrwxrwx 3 spiderftp ftp 4096 Sep 20 11:58 test_data [root@iZwz9id7ajv83jhb9gicj0Z spiders]# cd test_data/ [root@iZwz9id7ajv83jhb9gicj0Z test_data]# ls -l total 60 -rwxrwxrwx 1 spiderftp ftp 2484 Sep 19 17:07 batj_kb.py -rwxrwxrwx 1 spiderftp ftp 2806 Sep 19 17:07 batj_kb.pyc -rwxrwxrwx 1 spiderftp ftp 4751 Sep 19 17:07 batj_yb.py -rwxrwxrwx 1 spiderftp ftp 4801 Sep 19 17:07 batj_yb.pyc -rwxrwxrwx 1 spiderftp ftp 161 Sep 19 17:07 __init__.py -rwxrwxrwx 1 spiderftp ftp 132 Sep 19 17:07 __init__.pyc -rwxrwxrwx 1 spiderftp ftp 512 Sep 19 17:07 items.py -rwxrwxrwx 1 spiderftp ftp 606 Sep 19 17:07 items.pyc -rwxrwxrwx 1 spiderftp ftp 3900 Sep 19 17:07 sztj_tjkb.py -rwxrwxrwx 1 spiderftp ftp 3542 Sep 19 17:07 sztj_tjkb.pyc -rwxrwxrwx 1 spiderftp ftp 1522 Sep 19 17:07 sztj_tjyb.py -rwxrwxrwx 1 spiderftp ftp 2046 Sep 19 17:07 sztj_tjyb.pyc drwxrwxrwx 2 root root 4096 Sep 20 11:58 test Modify the user to whom the file belongs chown user file|dir (-R recurse into subfolders) [root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls -l total 60 -rw-r--r-- 1 spiderftp ftp 2484 Sep 19 17:07 batj_kb.py -rw-r--r-- 1 spiderftp ftp 2806 Sep 19 17:07 batj_kb.pyc -rw-r--r-- 1 spiderftp ftp 4751 Sep 19 17:07 batj_yb.py -rw-r--r-- 1 spiderftp ftp 4801 Sep 19 17:07 batj_yb.pyc -rw-r--r-- 1 spiderftp ftp 161 Sep 19 17:07 __init__.py -rw-r--r-- 1 spiderftp ftp 132 Sep 19 17:07 __init__.pyc -rw-r--r-- 1 spiderftp ftp 512 Sep 19 17:07 items.py -rw-r--r-- 1 spiderftp ftp 606 Sep 19 17:07 items.pyc -rw-r--r-- 1 spiderftp ftp 3900 Sep 19 17:07 sztj_tjkb.py -rw-r--r-- 1 spiderftp ftp 3542 Sep 19 17:07 sztj_tjkb.pyc -rw-r--r-- 1 spiderftp ftp 1522 Sep 19 17:07 sztj_tjyb.py -rw-r--r-- 1 spiderftp ftp 2046 Sep 19 17:07 sztj_tjyb.pyc drwxrwxrwx 3 spiderftp ftp 4096 Sep 20 11:58 test_data [root@iZwz9id7ajv83jhb9gicj0Z spiders]# chown root test_data/ -R [root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls -l total 60 -rw-r--r-- 1 spiderftp ftp 2484 Sep 19 17:07 batj_kb.py -rw-r--r-- 1 spiderftp ftp 2806 Sep 19 17:07 batj_kb.pyc -rw-r--r-- 1 spiderftp ftp 4751 Sep 19 17:07 batj_yb.py -rw-r--r-- 1 spiderftp ftp 4801 Sep 19 17:07 batj_yb.pyc -rw-r--r-- 1 spiderftp ftp 161 Sep 19 17:07 __init__.py -rw-r--r-- 1 spiderftp ftp 132 Sep 19 17:07 __init__.pyc -rw-r--r-- 1 spiderftp ftp 512 Sep 19 17:07 items.py -rw-r--r-- 1 spiderftp ftp 606 Sep 19 17:07 items.pyc -rw-r--r-- 1 spiderftp ftp 3900 Sep 19 17:07 sztj_tjkb.py -rw-r--r-- 1 spiderftp ftp 3542 Sep 19 17:07 sztj_tjkb.pyc -rw-r--r-- 1 spiderftp ftp 1522 Sep 19 17:07 sztj_tjyb.py -rw-r--r-- 1 spiderftp ftp 2046 Sep 19 17:07 sztj_tjyb.pyc drwxrwxrwx 3 root ftp 4096 Sep 20 11:58 test_data Modify the group to which a file belongs chgrp group file|dir (-R recurse into subfiles) [root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls -l total 60 -rw-r--r-- 1 spiderftp ftp 2484 Sep 19 17:07 batj_kb.py -rw-r--r-- 1 spiderftp ftp 2806 Sep 19 17:07 batj_kb.pyc -rw-r--r-- 1 spiderftp ftp 4751 Sep 19 17:07 batj_yb.py -rw-r--r-- 1 spiderftp ftp 4801 Sep 19 17:07 batj_yb.pyc -rw-r--r-- 1 spiderftp ftp 161 Sep 19 17:07 __init__.py -rw-r--r-- 1 spiderftp ftp 132 Sep 19 17:07 __init__.pyc -rw-r--r-- 1 spiderftp ftp 512 Sep 19 17:07 items.py -rw-r--r-- 1 spiderftp ftp 606 Sep 19 17:07 items.pyc -rw-r--r-- 1 spiderftp ftp 3900 Sep 19 17:07 sztj_tjkb.py -rw-r--r-- 1 spiderftp ftp 3542 Sep 19 17:07 sztj_tjkb.pyc -rw-r--r-- 1 spiderftp ftp 1522 Sep 19 17:07 sztj_tjyb.py -rw-r--r-- 1 spiderftp ftp 2046 Sep 19 17:07 sztj_tjyb.pyc drwxrwxrwx 3 root ftp 4096 Sep 20 11:58 test_data [root@iZwz9id7ajv83jhb9gicj0Z spiders]# chgrp root test_data/ [root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls -l total 60 -rw-r--r-- 1 spiderftp ftp 2484 Sep 19 17:07 batj_kb.py -rw-r--r-- 1 spiderftp ftp 2806 Sep 19 17:07 batj_kb.pyc -rw-r--r-- 1 spiderftp ftp 4751 Sep 19 17:07 batj_yb.py -rw-r--r-- 1 spiderftp ftp 4801 Sep 19 17:07 batj_yb.pyc -rw-r--r-- 1 spiderftp ftp 161 Sep 19 17:07 __init__.py -rw-r--r-- 1 spiderftp ftp 132 Sep 19 17:07 __init__.pyc -rw-r--r-- 1 spiderftp ftp 512 Sep 19 17:07 items.py -rw-r--r-- 1 spiderftp ftp 606 Sep 19 17:07 items.pyc -rw-r--r-- 1 spiderftp ftp 3900 Sep 19 17:07 sztj_tjkb.py -rw-r--r-- 1 spiderftp ftp 3542 Sep 19 17:07 sztj_tjkb.pyc -rw-r--r-- 1 spiderftp ftp 1522 Sep 19 17:07 sztj_tjyb.py -rw-r--r-- 1 spiderftp ftp 2046 Sep 19 17:07 sztj_tjyb.pyc drwxrwxrwx 3 root root 4096 Sep 20 11:58 test_data Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM. You may also be interested in:
|
<<: MySQL replication table details and example code
>>: How to add interface listening mask in Vue project
Features of SSHFS: Based on FUSE (the best usersp...
In actual web page development, accordions also a...
There are many read-write separation architecture...
There are several ways I know of to set anchor pos...
Table of contents background Problem Description ...
Install Follow the README to install The document...
Table of contents What is native JavaScript A. Ch...
1. Tools directory file structure [root@www tools...
The following demonstration is based on MySQL ver...
Deploy database based on docker sudo docker pull ...
In order to save installation time, I used the of...
First, let’s think about a question: To insert su...
MySQL is a free relational database with a huge u...
Preface: When designing a table in MySQL, MySQL o...
In front-end development, we are in direct contac...