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

What is the difference between useradd and adduser in Ubuntu

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces "what is the difference between useradd and adduser in Ubuntu". In daily operation, I believe that many people have doubts about the difference between useradd and adduser in Ubuntu. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the question of "what is the difference between useradd and adduser in Ubuntu?" Next, please follow the editor to study!

To create a new user in Ubuntu, you usually use two commands: useradd and adduser. Although the function is the same, the usage is not the same:

1. When using useradd, if you do not add any parameter options later, for example: the user created by # sudo useradd test will be the default "three nots" user: one without Home Directory, two without password, and three without system Shell.

two。 When using adduser, the process of creating users is more like a man-machine conversation. You will be prompted to enter all kinds of information, and then you will create new users based on that information.

Useradd is an ELF executable program

Useradd adds the user name and creates the same group name as the user name, but it does not create a user name-based directory under the / home directory, nor does it prompt for a new password.

-b,-base-dir BASE_DIR specifies the base directory of the home directory

-d,-home-dir HOME_DIR specifies the home directory

-g,-gid GROUP specify gid

-l.-no-log-init do not add the user to the lastlog and.

Faillog databases

Do not add a user to lastlog and failog. This user's login record does not need to be recorded.

-M,-no-create-home do not create a home directory

-p,-password PASSWORD specify the password of the new user

-r,-system set up a system account

-s,-shell SHELL specifies shell

Adduser-m-d / usr/system-s / bin/bash-p passwd system

Adduser is a perl script that can interactively set some user parameters.

Question:

The-p parameter of adduser does not allow shadow password

The parameters of / usr/sbin/usermod and useradd are similar.

Usermod-password PASSWORD username

To sum up, in Ubuntu, adduser is more suitable for beginners, because you don't have to remember those tedious parameter options, as long as you follow the tips of the system step by step, the disadvantage is that the whole creation process is more complex and long; and useradd is more suitable for users with some high-level experience, often one-line command plus parameters can solve a lot of problems, so it is very convenient to create.

At this point, the study on "what is the difference between useradd and adduser in Ubuntu" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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