- Linux:Powerful Server Administration
- Uday R. Sawant Oliver Pelz Jonathan Hobson William Leemans
- 310字
- 2021-07-09 18:16:43
Deleting a user account
If you no longer need a user account, it is good idea to delete that account.
Getting ready
You will need super user or root privileges to delete a group from the Ubuntu server.
How to do it...
Follow these steps to delete the user account:
- Enter the following command to delete a user account:
$ sudo deluser --remove-home john
- Enter your password to complete
addgroup
with root privileges:
How it works…
Here, we used the deluser
command with the option --remove-home
. This will delete the user account named john
and also remove the home
and mail spool
directories associated with john
. By default, the deluser
command will delete the user without deleting the home
directory.
It is a good idea to keep a backup of user files before removing the home
directory and any other files. This can be done with an additional flag along with the deluser
command:
$ deluser --backup --remove-home john
This will create a backup file with the name john.tar.gz
in the current working directory, and then the user account and the home
directory will removed.
There's more…
When called with the --group
option, the deluser
command will remove the group. Similarly, when called with two non-option arguments, the deluser
command will try to remove a user from a specific group:
$ deluser john guest # this will remove user john from group guest $ deluser --group guest # this will remove a group
If you want to disable the user account rather than delete it, you can do it with the following commands:
$ sudo usermod --expiredate 1 john # disable the user account john $ sudo usermod --expiredate "" john # re-enable user account john $ sudo usermod -e YYYY-MM-DD john # specify expiry date
See also
- Refer to the manual page for
deluser
withman deluser
- Hands-On Graph Analytics with Neo4j
- 平面設計初步
- Python Artificial Intelligence Projects for Beginners
- TIBCO Spotfire:A Comprehensive Primer(Second Edition)
- 人工智能工程化:應用落地與中臺構建
- 城市道路交通主動控制技術
- 分布式多媒體計算機系統
- 西門子S7-200 SMART PLC實例指導學與用
- 基于單片機的嵌入式工程開發詳解
- 單片機C語言應用100例
- 寒江獨釣:Windows內核安全編程
- AMK伺服控制系統原理及應用
- 人工智能云平臺:原理、設計與應用
- WPF專業編程指南
- 微機組裝與維護教程