Create and delete users in Ubuntu

Source: Internet
Author: User
Commands such as sudoadduserxxx will add an account sudouseraddxxx under the home Directory to only add users. It is easy not to add accounts in the home directory. Ubuntu provides two methods for adding graphical interfaces, the same as Windows, there is also a solution to the traditional addition of Linux: 1. in Ubuntu, there is a graphical interface. The method added has the user option under the System menu! Open, according

Commands such as sudo adduser xxx will add an account in the home Directory
Sudo useradd xxx only adds users and does not add accounts in the home Directory
Very simple Ubuntu provides two ways to add graphical interfaces, the same as Windows, and the traditional addition method of Linux.

Solution:

1. There is a graphic interface added in Ubuntu. There are user options under the System menu! Open and follow the prompts.

2. Add users through command lines in Linux,
(1) Open the terminal and enter the sudo-r useradd username/*-r parameter to create a system user.
(2) run the command "sudo useradd-g root username/*" to divide the user you just created into the root permission group.
(3) sudo passwd username/* set the password you just created

Delete:
Terminal method: Use newuser to replace the user account to be deleted.
Under the root user: userdel-r newuser
Under normal users: sudo userdel-r newuser
Because you need to completely delete the user, add the-r option to delete the user's home directory and email directory while deleting the user.

------------------------------ Split line ------------------------------

Create a new user named "add ROOT permission" and "Configure" In ubuntu. The "TAB key" cannot be used 」
 
1. Create a user www.linuxidc.com
Adduser New User Name
Passwd: The new user name is used to add a new user.
2. Create a Home Directory
# Cd/home
1. Create a home directory:
# Mkdir New User Name
 
2. Copy the environment variable template file:
# Cp/etc/skel/. B * support
# Cp/etc/skel/. p * support
 
3. Modify permissions
# Chown-R support. support
# Chmod 770 support
Www.linuxidc.com
3. Grant ROOT permissions
Method 1: Modify the/etc/sudoers file, find the following line, and remove the comment (#).
# Allows people in group wheel to run all commands
% Wheel ALL = (ALL) ALL
 
Then modify the user and make it belong to the root group (wheel). The command is as follows:
# Usermod-g root username
After the modification, you can log on with the new user name and account, and then run the su-command to obtain the root permission for the operation.
 
Method 2: Modify the/etc/sudoers file, find the following line, and add a line under root, as shown below:
# Allow root to run any commands anywhere
Root ALL = (ALL) ALL
New User Name ALL = (ALL) ALL
After the modification is completed, you can log on with the newly created username account and run the su-command to obtain the root permission for the operation.
 
4. You cannot use the TAB or up or down keys. The command line does not display the current path.
The default shell is/bin/sh for a Common Account Created in ubuntu, which does not support keys such as tab, change the shell of the "specified user" account to/bin/bash.
 
1. view the current shell:
# Echo $ SHELL
/Bin/sh
2. Modify shell to/bin/bash:
# Usermod-s/bin/bash Username

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.