Yuav ua li cas mus ntxiv / tshem tawm cov neeg siv, hloov password, create, edit groups and create sudo user on Debian linux?

Sau tag nrho lub zos neeg siv

cat /etc/passwd

Koj yuav tau siv cov nram qab no hais kom ua los sau tsuas yog tus username ib feem ntawm lub saum toj no /etc/passwd tso zis.

cut -d: -f1 /etc/passwd

Qhov saum toj no tsis: -d: siv cov nyuv li cov delimeter, -F1 tau tus thawj teb.

Koj yuav tsum muaj hauv paus rau cov nram qab no

su
Ntxiv tshiab neeg siv

adduser username

tshem tawm cov neeg siv

userdel username

Tus neeg siv directory yuav tsum tau tshem nyias yog tias yuav tsum

rm -r /home/username

Kho kom raug neeg username

usermod -l {new username} {old username}
hloov lo lus zais

passwd username
Tsim pab pawg neeg

groupadd groupname

Ntxiv neeg siv yuav pab pawg neeg
usermod -a -G groupname username

List all groups current user belongs to

groups

List all groups specific user belong to

groups username

Sau tag nrho cov pab pawg

cut -d: -f1 /etc/group
Create sudo user

usermod -aG sudo username

Test sudo user

sudo ls -la /root

The above only works for root/sudo user

You will require to input the user password for the 1st time

If sudo command does not work you will need to install sudo package

apt install sudo