Linux user management
2024-09-07 09:41:47 3 举报
AI智能生成
9/6
作者其他创作
大纲/内容
User Classification
root
regular users
system (virtual) users
User Files
/etc/passwd
/etc/group
/etc/shadow
/etc/skel
Used as a template for new user home directories.
User account
Add User
useradd -u 12345 -s /sbin/nologin -M mysql
Delete User
userdel
vim /etc/passwd
# user
# user
Modify User
user exist?
id username
view user information
grep username /etc/passwd
add user to root group
usermod -G root username
Query Users
whoami
Shows the current logged-in user
id
Displays user and group IDs and their names
cat /etc/passwd | grep username
w
uptime
who
last,lastlog
User Security
set a password and expiration time
Set or Change a User’s Password
sudo passwd username
Set Password Expiration Time
set the minimum days between password changes to 7 days,
warn the user 5 days before the password expires, and
set the account to be inactive for 15 days after expiration
warn the user 5 days before the password expires, and
set the account to be inactive for 15 days after expiration
sudo chage -m 7 -W 5 -I 15 username
password and account settings
sudo chage -l username
Sudo Privilege Escalation
visudo
=vim /etc/sudoers
=vim /etc/sudoers
Alias-Based Security Protections
alias rm
vim /etc/profile
G
o
alias rm='echo pls do not use rm'
G
o
alias rm='echo pls do not use rm'
vim ~/.bashrc
#rm
#rm
force use rm
\rm -fr file
/bin/rm file
unalias rm
Jump Server
Bastion Host
no bastion host
history -c
delete history
delete history
history -w
writes the current shell's in-memory history to the history file (usually ~/.bash_history)
writes the current shell's in-memory history to the history file (usually ~/.bash_history)
demo.jumpserver.org
Additional Content
Xshell doesnt work
git bash
powershell
0 条评论
下一页