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 use commands to increase users in Linux system

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

The editor today takes you to understand how to use commands to increase users in the Linux system. The knowledge points in the article are introduced in great detail. Friends who feel helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's follow the editor to learn more about "how to use commands to increase users in the Linux system".

Linux is a multi-tasking and multi-user system. The useradd or adduser command is used to establish the user account and the user's starting directory, and the permission is superuser.

The useradd or adduser command under Linux is used to set up a user account and create a user's starting directory, and the permission is superuser.

* Syntax: *

Useradd [parameters] name

* parameters: *

-c: add the comment text, which is saved in the remarks column of passwd. -d:-home-dir HOME_DIR specifies the home directory-e: specifies the expiration date of the account. The date format is MM/DD/YY, for example, 06ly30and12. 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:-gid GROUP specifies gid-G: specifies the additional group to which the user belongs. -l: do not add users to lastlog and failog, this user's login record does not need to be recorded.-m: automatically establish the user's login directory. -M: do not automatically create a user's login directory. -n: cancels the establishment of a group with the user name. -p:-password PASSWORD specifies the password of the new user-r:-system establishes a system account-s: specifies the shell to be used by the user after login. 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.

* examples of usage: *

Non-root users need to temporarily adjust their permissions to execute useradd, preceded by sudo

* add a new user: user1*

Under root: useradd user1

Other users: sudo useradd user1

View the list of linux users: cat / etc/passwd

* add a new user: user2 and specify a user group: ftp*

Under root: useradd-g ftp user2

* add a new user: user4 and specify home directory: / mnt/bak/*

Under root: useradd-d / mnt/back/ user4

If there is no such directory, an error will be reported, and you will need to create the directory manually.

You need to change to create a directory under root, and login will be normal after creation. (you can also create sudo rights)

* add a new user: user5 and set the password to 123456 *

Under root: useradd-p 123456 user5

View linux user password: cat / etc/shadow

Add a new FTP user: ftp2018 (no need to log in to the system)

Under root: useradd-g ftp-s / sbin/nologin ftp2018

Thank you for your reading, the above is the whole content of "how to use commands to increase users in the Linux system". Friends who learn to learn to do it quickly. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!

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

Development

Wechat

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

12
Report