Linux user commands

Change user or privilege command

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

Pattern 1 expressed by numbers

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

Represented by two letters of pattern

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

Linux user commands
Linux commands
linux commands
Linux commands
Linux commands
Network Linux commands
Verbalize Linux commands
New Linux commands! !!
Basic LINUX commands
Various Linux commands
Typical Linux commands (7)
Frequently used linux commands
[Linux] Group related commands
Linux commands to remember
New Linux commands! !! Part 2
[Linux] Change user password
Studying Linux commands and frustration
Linux
[Linux] User / group command summary
Basic knowledge of Linux and basic commands
Linux Frequently Used Commands [Personal Memo]
Handle dates in Linux bash commands
[Linux Mint 20] Various WiFi confirmation commands
[Linux] Frequently used Linux commands (file operation)
Convenient shortcut keys for Linux commands! !! !!
Frequently used Linux commands (for beginners)
Linux commands that you often forget
[Linux] File and directory operation commands
List of frequently used Linux commands
Try compiling Linux commands (cross-compilation practice)
Linux commands related to character code
[Linux] Frequently used Linux commands (folder operation)
About Linux commands Super basic edition
Note: Linux concepts and minimum commands
Use Linux commands on Android devices
Linux (for users and su / sudo commands)
linux memorandum
Linux command # 4
Create your own Linux commands in Python
Linux command # 3
Linux overview
[Linux] Review of frequently used basic commands 2
I created an SFTP-only user on Linux.
Linux basics
direnv (linux)
[Linux] Summary of middleware version confirmation commands
[Linux] List of Linux commands used in practice
Organize Linux
Linux practice
Ubuntu Linux 20.04
Linux process
Quick reference table: Linux disk related commands
Linux permissions
Basic commands
Linux command # 5
About Linux
Summary of petit techniques for Linux commands
Linux basics
[Linux] Review of frequently used basic commands
Forgot linux
[Linux] Learn the basics of shell commands