In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to add user commands in linux, I believe that most people do not know much about it, so share this article for you to learn, I hope you will learn a lot after reading this article, let's go to learn the method!
The command to add a user to linux is: useradd or adduser. Both commands can be used to create a user account and create a starting directory for the user, with the permission of the superuser. After the account is created successfully, you can use the passwd command to set the password for the account.
Users can use the command useradd or adduser to add users to linux. These two commands are used to set up the user account and create the user's starting directory, and the permission is superuser.
Syntax:
Useradd [- d home] [- s shell] [- c comment] [- m [- k template]] [- f inactive] [- e expire] [- p passwd] [- r] name
Introduction of main parameters:
-c: add the comment text, which is saved in the remarks column of passwd.
-d: specify the home directory when the user logs in, replacing the system default / home/
-D: change the default value.
-e: specify the expiration date of the account, which is in the format of MM/DD/YY, such as 06max 30max 12. The default means permanent.
-f: specify how many days after the password expires to close the account. If the account is 0, it is disabled immediately; if it is-1, the account is always available. The default value is-1.
-g: specify the group to which the user belongs. Value can make the group name also be GID. The user group must already exist, and the period default is 100, that is, users.
-G: specifies the additional group to which the user belongs.
-m: automatically establish the login directory of the user.
-M: do not automatically create a user's login directory.
-n: cancels the establishment of a group with the user name.
-r: set up a system account.
-s: specifies the shell to be used by the user after logging in. The default is / bin/bash.
-u: specify the user ID number. This value must be unique in the system. 0room499 is reserved for system user accounts by default, so the value must be greater than 499.
Details:
Useradd can be used to set up a user account, which is the same as the adduser command. After the account is set up, use passwd to set the password of the account. The account created with the useradd command is actually saved in the / etc/passwd text file.
For example:
For example, we want to set up a new user account testuser1, and set UID to 544, home directory to / usr/testuser1, belonging to the users group.
# useradd-u 544-d / usr/testuser1-g users-m testuser1
-m means that it is automatically created if the home directory does not exist.
These are all the contents of the method of adding user commands in linux. 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.