User Management In Ubuntu (3) User Management

Source: Internet
Author: User
Similar to groups, Ubuntu provides command line tools to manage users and GUI tools to manage users. In comparison, the command line tool is more powerful and flexible. Common User management command line tools include: useradd -- Add a new user to Linux. The options that can be customized mainly include the user's/home directory and start group. (The default/home directory is/home/username, and the default group name is username.) useradd-D -- this command is used to create a new user.

Similar to groups, Ubuntu provides command line tools to manage users and GUI tools to manage users. In comparison, the command line tool is more powerful and flexible. Common User management command line tools include:

Useradd -- Add a new user to Linux. The options that can be customized mainly include the user's/home directory and start group. (The default/home directory is/home/username. The default group name is the user name)

Useradd-D -- this command is the default setting when the system creates a new user. If no parameters are used, the current default settings of the system are returned.

Userdel -- this command completely removes the user account (including deleting the/home directory of the user and all files in the directory ).

Passwd -- "authentication tokens" used to update the password management system"

Usermod -- Change User attributes. The most commonly used parameters include-s to change shell and-u to change UID. When a user logs on to the system or runs a program, the user attributes cannot be changed.

Chsh -- this command changes the user's default shell. For Ubuntu systems, the default shell is/bin/bash, that is, Bourne Again Shell.

The following is a simple example to create a user. Here we use the-p option to set the password, the-s option to set the shell, and the-u option to set the UID (when using the default settings to create a user, you do not need to specify these options ).

Sudo useradd sunny-p AbcDe-s/bin/zsh-u 1042


Monitor user ACTIVITIES IN THE SYSTEM

The w command can tell the system administrator which users are logged on to the system, where they are logged on, and what are currently being done. Add the user name after the w command to return only the status of a specific user.

The ac command returns the user's total link time. It obtains information from the/var/log/wtmp file. To use the ac command, install the acct software package.

The last command retrieves information from/var/log/wtmp and lists all login records created by users from this file.

The lastb command outputs all failed/wrong logins, which provides good guidance for system maintenance.

To lock a user's account, run the following command: sudo passwd-l username. You can use the-u option, that is, sudo passwd-u username.

Related Article

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.