/etc/pam.d/su file and find the following line:#auth required pam_wheel.so use_uid
auth required pam_wheel.so use_uid
sudo usermod -aG wheel <username>
/etc/pam.d/system-auth file and add or modify the following lines to set the password complexity policy:password requisite pam_pwquality.so try_first_pass local_users_only retry=3 minlen=8 dcredit=-1 ucredit=-1 ocredit=-1 lcredit=-1password sufficient pam_unix.so sha512 shadow nullok try_first_pass use_authtok
Parameter | Description |
minlen=8 | The password must contain at least 8 characters. |
dcredit=-1 | Contains at least 1 digit. |
ucredit=-1 | Contains at least 1 uppercase letter. |
lcredit=-1 | Contains at least 1 lowercase letter. |
ocredit=-1 | Contains at least 1 special character. |
retry=3 | Allows up to 3 attempts. |
chage command or modifying the /etc/login.defs file:/etc/login.defs and modify the following parameters:PASS_MAX_DAYS 90 # Maximum number of days a password can be usedPASS_MIN_DAYS 1 # Minimum number of days a password must be used before it can be changed (to prevent frequent password changes)PASS_WARN_AGE 7 # Warn 7 days before the password expires
# Set user passwords to expire after 90 dayssudo chage --maxdays 90 <username># View user password expiration informationsudo chage -l <username>
/etc/pam.d/system-auth and add the following line before the pam_unix.so line:password required pam_pwhistory.so remember=5 use_authtok
sudo vi /etc/ssh/sshd_config
#PermitRootLogin prohibit-password
PermitRootLogin no
sudo sshd -t to verify the configuration syntax. Keep the current session open, and after the restart, confirm that a new SSH connection can be established before disconnecting the current session.sudo systemctl restart sshd
dnf install sudo
visudo command to safely edit the sudoers file:sudo visudo
visudo instead of directly editing /etc/sudoers, because visudo checks the syntax before saving to prevent configuration errors that could make sudo unavailable.<username> ALL=(ALL) ALL
%wheel ALL=(ALL) NOPASSWD: ALL
<username> ALL=(ALL) /usr/bin/systemctl restart nginx, /usr/bin/systemctl reload nginx
# User aliasUser_Alias ADMINS = alice, bob# Command aliasCmnd_Alias NETWORKING = /usr/sbin/ifconfig, /usr/sbin/route, /usr/sbin/dnf# AuthorizationADMINS ALL=(ALL) NETWORKING
Defaults logfile=/var/log/sudo.log
/var/log/secure). Check these logs regularly to detect abnormal activity:# View sudo logssudo grep sudo /var/log/secure
Defaults timestamp_timeout=5
sudo dnf update
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários