Switch to root user(The current directory remains the same)
sudo su
Switch to root user(Go to root user's home directory)
sudo su -
Change the authority that can handle the target file
chmod permission file name
There are two ways to display authority
Authority expression
1 Execution permission only
2 Write permission only
3 Run+Write permission
4 Read permission only
5 Read+Run
6 Read+write
7 Read+write+Run
Example
chmod 654 testfile.txt
ls -l
total 0
-rw-r-xr-- 1 user group 0 10 15 21:04 testfile.txt
User representation
u → user
g → Group
o → Other
a → All users
Authority expression
r read
w write
x run
Change expression
+Add from the current status
-Delete from the current status
=Specify the result directly
Example__Read all users and change to execute permission
# chmod a=rx testfile.txt
# ls -l
total 0
-r-xr-xr-x 1 user group 0 10 15 21:10 testfile.txt
Change ownership of target fill
chown change user name target file
#When changing the group name
chown change username:Change group name Target file
#When changing directory ownership
chown -R Change user name Target directory
Set and update password
passwd username#If you omit the user name, you can change your password
Recommended Posts