Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add users and user groups in Centos7

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to add users and user groups in Centos7". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to add users and user groups in Centos7".

Before using Centos, more Ubuntu is used, so there is ambiguity between the two commands useradd and adduser. On Ubuntu systems, these are two commands, while on Centos it is the same command, and adduser exists in the form of links.

# ll / usr/sbin/ | grep user lrwxrwxrwx. 1 root root 7 October 30 17:09 adduser-> useradd-rwxr-x---. 1 root root 114064 June 10 09:16 useradd

1. Add users, Centos does not have any interactive action! After you have created the user, you must change your password or you cannot log in

# useradd dev # create user # passwd dev # change the password of user dev. New password: re-enter the new password: passwd: all authentication tokens have been successfully updated.

2. Add sudo permissions for new users, otherwise you have to consult root boss about everything, you know!

1) add writeable permissions to sudoers files

# chmod-v UCPW / etc/sudoers "/ etc/sudoers" permission mode remains at 0640 (rw-r-)

2) add new user information to # # Allow root to run any commands anywher in the sudoers file, and the modified effect is

# # Allow root to run any commands anywher root ALL= (ALL) ALL dev ALL= (ALL) ALL # add user information

3) cancel the writeable permission of sudoers file

# chmod-v Umurw / etc/sudoers mode of "/ etc/sudoers" changed from 0640 (rw-r-) to 0440 (rmermerr -)

Set up a working group

Groupadd test / / create a new test working group

New users add workgroups at the same time

Useradd-g test phpq / / create a new phpq user and add to the test workgroup

Note:-g belongs to the group-d home directory-s SHELL used

Add workgroups to existing users

Usermod-G groupname username or: gpasswd-a user group

Add: ways to view users and user groups

User list file: / etc/passwd

User group list file: / etc/group

Check which users are in the system: cut-d:-f 1 / etc/passwd

Check the user who can log in to the system: cat / etc/passwd | grep-v / sbin/nologin | cut-d:-f 1

View a user: W user name

View logged in user: who

View user login history: last

The above is all the content of the article "how to add users and user groups in Centos7". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report