This article mainly introduces the user management of Ubuntu, including the establishment and deletion of users, user authorization, etc.
================== create user and authorize ==================
sudo adduser XXX will add an account in the home directory sudo useradd xxx is simply adding users and will not add accounts in the home directory
1.1. Add user, configure password
sudo AddUser AAAA sudo passwd AAAA
1.2. Modify the user group to belong to the root group (wheel)
Usermod-g Root AAAA
1.3. Give root privileges
Modify the/etc/sudoers file, find the following line, remove the previous comment (#)
sudo vi /etc/sudoers
inch group wheel to run all commands%wheel all= (All) all
AAAA all= (All) all
You can also add a row under ROOT to authorize the specified user
After the modification, you can log in with the new user account and then use the command Su-to get root permission to operate.
1.4. Edit configuration file Configuration root login
sudo gedit/etc/ssh/sshd_config
# comment out Permitrootlogin without-password# enable Permitrootlogin Yes
Service sshd Restart
================== Delete User ===================
Under the root User:
Userdel-r AAAA
Under the ordinary User:
sudo userdel-r aaaa
The user needs to be completely removed, plus the-r option to remove the user's host directory and the Mail directory while deleting the user.
==================== Expansion: ====================
The normal user cannot use the TAB key, the upper and lower key, the command line does not display the current path?
Because the default Ubuntu created by the normal account, the default shell is/bin/sh, and this does not support tab key, so the "designated user" account of the shell changed to/bin/bash.
1. View the current shell:
Echo $SHELL/bin/sh
2. Modify the Shell to/bin/bash:
Usermod-s/bin/bash AAAA
Finished, hehe hehe
Ubuntu User Management