Linux Create User Account

Posted 成成先生

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux Create User Account相关的知识,希望对你有一定的参考价值。

Q. How do I create a new Linux user account ? How do update or modify default Linux new user information? Using the command prompt (shell) tools, how do I add a user to the system? What are command line options for adding a user?

A. To create a new user account under any Linux distribution use command called useradd. The system administrator is responsible for creating account. Login as root user (or use sudo command).

useradd command syntax

[plain] view plain copy print ?
  1. useradd [options] username  
useradd [options] username

Depending on command line options, the useradd command will update system files (/etc/passwd and /etc/shadow file with password) and may also create the new user's home directory and copy initial files.

Linux add a new user called rakhi

Type the command as follows:

[plain] view plain copy print ?
  1. useradd rakhi  
useradd rakhi

Set a password for rakhi:

[plain] view plain copy print ?
  1. passwd rakhi  
passwd rakhi

Without password user account will be in locked status. To unlock the account, you need to use above passwd command. Use passwd command to assign a password and set password aging guidelines.

Set account disable date

You can set date for the account to be disabled in the format YYYY-MM-DD with -e option while creating account itself:

[plain] view plain copy print ?
  1. useradd -e yyyy-mm-dd username  
  2. useradd -e 2008-12-31 jerry  
useradd -e yyyy-mm-dd username
useradd -e 2008-12-31 jerry


Set default password expiry

The -f days option set number of days after the password expires until the account is disabled. (If 0 is specified, the account is disabled immediately after the password expires. If -1 is specified, the account is not be disabled after the password expires.)

以上是关于Linux Create User Account的主要内容,如果未能解决你的问题,请参考以下文章

How to add user account on Linux(Automatically and Manually)

三十九Linux 线程——线程的同步和互斥

python lambda_create_account.py

php 在Checkout页面上自动选中Create Account Box

在其他两个模型之间创建关联时传递用户 ID

剥开比原看代码11:比原是如何通过接口/create-account创建帐户的