Home System Tutorial LINUX What are the regulations for user groups in Linux systems?

What are the regulations for user groups in Linux systems?

Mar 08, 2024 am 09:43 AM

1User management 1.1useradd add user

Basic sentence pattern: useradd username (function description: add new user)

Case: [root@lagou~]#useraddhadoop

1.2passwd sets user password

Basic sentence pattern: passwd username (function description: set user password)

Case:

linux组权限_linux设置用户权限文件_linux设置用户组权限

1.3id determines whether the user exists

Basic sentence pattern: id username

Case:

1.4su switch user

Basic sentence pattern:

Case:

[root@lagou~]#suhadoop

[root@lagou~]#su-hadoop

1.5userdel delete user

Basic sentence pattern:

userdel username (function description: delete the user but save it in the owner's directory)

userdel-r username (function description: delete the user and user directories)

Case:

1.6who View logged in user information

Basic sentence pattern:

1.7 Set Linux ordinary users to have root permissions, that is, the use of sudo

linux组权限_linux设置用户权限文件_linux设置用户组权限

sudo command:

sudo is a linux system management command. It is a tool that allows system administrators to let ordinary users execute some or all root commands. linux sets user group permissions, such as halt embedded linux training, reboot, su and so on. In addition to reducing the login and management time of the root userlinux setting user group permissions, this also enhances security.

Change configuration file:

Change the /etc/sudoers file, find the line below, and add a line under root, as shown below: vim/etc/sudoers

Log in as user tom and operate the administrator command

Essence: Use temporary administrator rights

linux设置用户权限文件_linux组权限_linux设置用户组权限

1.8 Check what users have been created

Basic sentence pattern: cat/etc/passwd

2User Group Management

Introduction: Each user has a user group, and the system can centrally manage all users in a user group. Different Linux systems have different regulations on user groups. For example, a user under Linux belongs to a user group with the same name. This user group is created at the same time when the user is created. The management of user groups involves adding, deleting, and changing user groups. Lowering, deleting and changing groups are actually updates to the /etc/group file

2.1groupadd new group

Basic sentence pattern: groupadd group name

Case:

Lower a hadoop group: groupaddhadoop

2.2groupdel delete group

Basic sentence pattern: groupdel group name

Case:

Delete hadoop group: groupdelhadoop

2.3groupmod changes group

Basic sentence pattern: groupmod-n new group name old group name

Case:

Change the hadoop group name to hadoop1:groupmod-nhadoop1hadoop

2.4 Check what groups were created

Basic sentence pattern: cat/etc/group

2.5usermod changes the group to which the user belongs

Basic sentence pattern: usermod-g user group username

Case:

Add user hadoop to mygroup user group: sermod-gmygrouphadoop

3File Permissions

Introduction: The Linux system is a typical multi-user system. Different users are in different positions and have different permissions. In order to protect the security of the system, the Linux system has different regulations on the permissions of different users to access the same file (including directory files). In Linux, we can use the ll or ls-l command to display the attributes of a file and the user and group to which the file belongs.

3.1 File Permissions

linux设置用户组权限_linux设置用户权限文件_linux组权限

Explanation based on letter position:

linux设置用户权限文件_linux组权限_linux设置用户组权限

Permissions are segmented, each segment represents a different user:

linux组权限_linux设置用户权限文件_linux设置用户组权限

3.2 File permission management

Change file permissions:

linux设置用户权限文件_linux设置用户组权限_linux组权限

3.3chown changes owner

Basic sentence pattern: chown end user (function description: change the owner of a file or directory)

Case: [root@lagoutest]#chownhadooptest1.txt

3.4chgrp changes the group it belongs to

Basic sentence pattern: chgrp end user group (function description: change the group to which a file or directory belongs)

Case:

linux设置用户权限文件_linux组权限_linux设置用户组权限

The above is the detailed content of What are the regulations for user groups in Linux systems?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1583
276
How to check my Linux system information and version? How to check my Linux system information and version? Jul 26, 2025 am 02:59 AM

If you want to know the Linux system information and version, you can use the following steps: 1. Use lsb_release-a to view the distribution information; 2. View the /etc/os-release file to obtain version details; 3. Use uname-r or uname-mrs to confirm the kernel version and system architecture; 4. Run lscpu, free-h or dmidecode (requires root permissions) to obtain hardware information. The above method is applicable to different distributions, and some commands may require installation or permission adjustment.

How to Schedule Tasks on Linux with Cron and anacron How to Schedule Tasks on Linux with Cron and anacron Aug 01, 2025 am 06:11 AM

cronisusedforpreciseschedulingonalways-onsystems,whileanacronensuresperiodictasksrunonsystemsthataren'tcontinuouslypowered,suchaslaptops;1.Usecronforexacttiming(e.g.,3AMdaily)viacrontab-ewithsyntaxMINHOURDOMMONDOWCOMMAND;2.Useanacronfordaily,weekly,o

How to install software on Linux using the terminal? How to install software on Linux using the terminal? Aug 02, 2025 pm 12:58 PM

There are three main ways to install software on Linux: 1. Use a package manager, such as apt, dnf or pacman, and then execute the install command after updating the source, such as sudoaptininstallcurl; 2. For .deb or .rpm files, use dpkg or rpm commands to install, and repair dependencies when needed; 3. Use snap or flatpak to install applications across platforms, such as sudosnapinstall software name, which is suitable for users who are pursuing version updates. It is recommended to use the system's own package manager for better compatibility and performance.

The Ultimate Guide to High-Performance Gaming on Linux The Ultimate Guide to High-Performance Gaming on Linux Aug 03, 2025 am 05:51 AM

ChoosePop!_OS,Ubuntu,NobaraLinux,orArchLinuxforoptimalgamingperformancewithminimaloverhead.2.InstallofficialNVIDIAproprietarydriversforNVIDIAGPUs,ensureup-to-dateMesaandkernelversionsforAMDandIntelGPUs.3.EnabletheperformanceCPUgovernor,usealow-latenc

What are the main pros and cons of Linux vs. Windows? What are the main pros and cons of Linux vs. Windows? Aug 03, 2025 am 02:56 AM

Linux is suitable for old hardware, has high security and is customizable, but has weak software compatibility; Windows software is rich and easy to use, but has high resource utilization. 1. In terms of performance, Linux is lightweight and efficient, suitable for old devices; Windows has high hardware requirements. 2. In terms of software, Windows has wider compatibility, especially professional tools and games; Linux needs to use tools to run some software. 3. In terms of security, Linux permission management is stricter and updates are convenient; although Windows is protected, it is still vulnerable to attacks. 4. In terms of difficulty of use, the Linux learning curve is steep; Windows operation is intuitive. Choose according to requirements: choose Linux with performance and security, and choose Windows with compatibility and ease of use.

The Importance of Time Synchronization on Linux with NTP The Importance of Time Synchronization on Linux with NTP Aug 01, 2025 am 06:00 AM

Timesynchronizationiscrucialforsystemreliabilityandsecuritybecauseinconsistenttimecauseslogconfusion,securityfailures,misfiredscheduledtasks,anddistributedsystemerrors;1.CheckNTPstatususingtimedatectlstatustoconfirmsynchronizationandserviceactivity;2

Setting up a Git Server on a Linux Machine Setting up a Git Server on a Linux Machine Jul 28, 2025 am 02:47 AM

Install Git: Install Git through the package manager on the server and verify the version; 2. Create a dedicated Git user: Use adduser to create a git user and optionally restrict its shell access; 3. Configure developer SSH access: Set the .ssh directory and authorized_keys file for git users, and add the developer's public key; 4. Create a bare repository: Initialize the bare repository on the server and set correct ownership; 5. Client cloning and push: Developer cloning the repository through SSH, submit changes and successfully push code to complete the construction of a private Git server.

Understanding RAID Configurations on a Linux Server Understanding RAID Configurations on a Linux Server Aug 05, 2025 am 11:50 AM

RAIDimprovesstorageperformanceandreliabilityonLinuxserversthroughvariousconfigurations;RAID0offersspeedbutnoredundancy;RAID1providesmirroringforcriticaldatawith50�pacityloss;RAID5supportssingle-drivefailuretoleranceusingparityandrequiresatleastthre

See all articles