The difference between Linux Useradd and AddUser,/sbin/nologin and/bin/bash__linux

Source: Internet
Author: User


the difference between Useradd and AddUser

Add User

1. Under root permissions, Useradd just created a username, such as (Useradd + username), it did not create a folder with the same name in the/home directory, and did not create a password, so use this user login system, is not login, in order to avoid such a situation, you can use (Useradd-m + username), it creates a folder with the same name in the/home directory and then uses (passwd + username) to set the password for the specified user name.

Add User: Useradd-m user name and then Set password passwd username


2. You can create a new user (AddUser + username) directly using AddUser This will automatically create a folder with the same name (create a user's home directory) under the/home directory, establish a group with the same name, create a new user password, and copy the file home directory from the/etc/skel directory to complete initialization. Whether to encrypt the home directory, and so on.

Add User: AddUser + user Name

--------------------------------------------------------------------------------------------------------------- ------------------------------------------------

Delete User

Delete the user, "Userdel user name" can be. It is a good idea to leave the files on the system as well, and you can use the Userdel-r username to implement them.

Delete User: Userdel-r user name

ii./sbin/nologin and/bin/bash change whether users can log on SSH

Usermod-s/sbin/nologin + user name

Usermod-s/bin/bash + user name


nologin Command

User and Workgroup Management Nologin commands enable you to politely reject a user's login system and give you information. If you try to log in as such a user, add a record in the log and then output this available information in the terminal, which is the case. General settings Such an account is used to start the service account, this is only to start up the service, but can not log on to the system.

Syntax Nologin instance Linux prohibits users from logging on: Users cannot log on to the system, but can log on to FTP, samba, and so on.

We do system maintenance under Linux, we hope that individual users or all users can not log into the system, to ensure that the system during the maintenance of normal operation. This time we will prohibit users from logging in.

1, prohibit individual users login, such as the prohibition of Lynn User login.

Passwd-l Lynn This means locking the user of the Lynn so that the user cannot log on.

Passwd-u Lynn is unlocking the locked user Lynn, and the user can log in.


2, we modify the/etc/passwd file in the user login shell vi/etc/passwd change to: Lynn:x:500:500::/home/lynn:/sbin/nologin the user can not log in. 3, prohibit all users to log in. Touch/etc/nologin users other than root cannot log in.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.