[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6PZWNC3Z0M4BFJBW70GC721":3,"skill-same:01M6PZWNC3Z0M4BFJBW70GC721":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":28,"commitSha":52,"skillDirectory":53,"forksCount":13,"repositoryHtmlUrl":54,"repositoryHomepageUrl":6,"ownerHtmlUrl":55,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M6PZWNC3Z0M4BFJBW70GC721","user-management",null,"Manage users, groups, and permissions on Linux systems. Configure sudo and access controls. Use when managing system access.","duc-duy-1612\u002FOnline-Delivery-Systems-Web","duc-duy-1612","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F192231384?v=4","01M6NSDKQQDKVTHZ8DZMZ1VYY6","01M6NSDKW8DDVTQHBT1HBDDJPT",0,"MIT","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fuser-management\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"user management","management","user","manage","sudo","relevant","scripts","critical","os","platform","main","community","linux","only","system","configure","access","devops-security","permissions","security","2026-11-10 10:12:30",false,"---\nname: user-management\ndescription: Manage users, groups, and permissions on Linux systems. Configure sudo\n  and access controls. Use when managing system access.\ncategory: devops\nrisk: critical\nsource: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\nsource_repo: BagelHole\u002FDevOps-Security-Agent-Skills\nsource_type: community\ndate_added: '2026-09-20'\nlicense: MIT\nlicense_source: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE\ncompatibility: Requires the relevant OS\u002Fplatform tooling and privileged access where\n  noted. Docs-only; helper scripts and templates not bundled.\nmetadata:\n  author: devops-skills\n  version: '1.0'\n---\n\n# User Management\n\nManage users, groups, permissions, sudo access, PAM modules, and LDAP integration on Linux systems. Includes practical scripts for bulk user operations and access auditing.\n\n## When to Use\n\n- Creating and managing local user accounts on Linux servers\n- Configuring sudo access with fine-grained privilege controls\n- Setting up group-based access control for teams\n- Integrating Linux hosts with LDAP or Active Directory for centralized auth\n- Auditing user accounts, permissions, and access patterns\n- Automating bulk user provisioning and deprovisioning\n\n## Prerequisites\n\n- Root or sudo access on the target system\n- `shadow-utils` package (provides useradd, usermod, etc.) -- installed by default\n- `libpam-modules` for PAM configuration\n- For LDAP: `sssd`, `realmd`, `libpam-ldapd`, or `nslcd` packages\n- For auditing: `auditd` package\n\n## User Operations\n\n### Creating Users\n\n```bash\n# Create a user with home directory, default shell, and comment\nuseradd -m -s \u002Fbin\u002Fbash -c \"Jane Smith\" jsmith\n\n# Set the user's password interactively\npasswd jsmith\n\n# Create a user with a specific UID and primary group\nuseradd -m -s \u002Fbin\u002Fbash -u 1500 -g developers -c \"Deploy Account\" deploy\n\n# Create a system account (no home, no login shell) for running services\nuseradd -r -s \u002Fusr\u002Fsbin\u002Fnologin -d \u002Fopt\u002Fmyapp -c \"MyApp Service Account\" myapp\n\n# Create a user with an expiration date (contractor access)\nuseradd -m -s \u002Fbin\u002Fbash -e 2025-12-31 -c \"Contractor - Bob Lee\" blee\n\n# Create user and add to multiple supplementary groups at creation time\nuseradd -m -s \u002Fbin\u002Fbash -G docker,developers,ssh-users -c \"Dev User\" devuser\n```\n\n### Modifying Users\n\n```bash\n# Add a user to a supplementary group (preserving existing groups with -a)\nusermod -aG sudo jsmith\nusermod -aG docker,developers jsmith\n\n# Change the user's login shell\nusermod -s \u002Fbin\u002Fzsh jsmith\n\n# Change the user's home directory and move existing files\nusermod -d \u002Fhome\u002Fjsmith-new -m jsmith\n\n# Lock a user account (disable login without deleting)\nusermod -L jsmith\n\n# Unlock a user account\nusermod -U jsmith\n\n# Set an account expiration date\nusermod -e 2025-06-30 blee\n\n# Change a user's login name\nusermod -l jsmith-new jsmith\n\n# Force password change on next login\nchage -d 0 jsmith\n\n# Set password aging: min 7 days, max 90 days, warn 14 days before\nchage -m 7 -M 90 -W 14 jsmith\n\n# View password aging info\nchage -l jsmith\n```\n\n### Deleting Users\n\n```bash\n# Remove a user and their home directory\nuserdel -r jsmith\n\n# Remove a user but keep their home directory (for auditing)\nuserdel jsmith\n\n# Find and reassign files owned by a deleted user (by UID)\nfind \u002F -uid 1500 -exec chown newowner:newgroup {} \\;\n```\n\n## Group Management\n\n```bash\n# Create a new group\ngroupadd developers\n\n# Create a group with a specific GID\ngroupadd -g 2000 devops\n\n# Add a user to a group\nusermod -aG developers jsmith\n# Alternative using gpasswd\ngpasswd -a jsmith developers\n\n# Remove a user from a group\ngpasswd -d jsmith developers\n\n# Set group administrators (can add\u002Fremove members without root)\ngpasswd -A jsmith developers\n\n# Delete a group\ngroupdel developers\n\n# List all groups a user belongs to\ngroups jsmith\nid jsmith\n\n# List all members of a group\ngetent group developers\n\n# Show all groups on the system\ncat \u002Fetc\u002Fgroup | cut -d: -f1 | sort\n```\n\n## Sudo Configuration\n\n```bash\n# Always edit sudoers via visudo (syntax validation prevents lockout)\nvisudo\n\n# Better: use drop-in files in \u002Fetc\u002Fsudoers.d\u002F\nvisudo -f \u002Fetc\u002Fsudoers.d\u002Fdevelopers\n```\n\n### \u002Fetc\u002Fsudoers.d\u002Fdevelopers\n\n```text\n# Allow the developers group to restart specific services\n%developers ALL=(ALL) NOPASSWD: \u002Fusr\u002Fbin\u002Fsystemctl restart myapp, \u002Fusr\u002Fbin\u002Fsystemctl status myapp\n\n# Allow a deploy user full sudo with no password\ndeploy ALL=(ALL) NOPASSWD: ALL\n\n# Allow ops team to run docker commands only\n%ops ALL=(ALL) NOPASSWD: \u002Fusr\u002Fbin\u002Fdocker, \u002Fusr\u002Fbin\u002Fdocker-compose\n\n# Allow a user to run commands as a specific service account\njsmith ALL=(myapp) NOPASSWD: \u002Fopt\u002Fmyapp\u002Fbin\u002F*\n\n# Restrict to specific hosts (useful with centralized sudoers)\njsmith dbservers=(root) \u002Fusr\u002Fbin\u002Fsystemctl restart postgresql\n\n# Log all sudo commands to a dedicated file\nDefaults log_output\nDefaults!\u002Fusr\u002Fbin\u002Fsudoreplay !log_output\nDefaults logfile=\"\u002Fvar\u002Flog\u002Fsudo.log\"\n\n# Require password re-entry every 5 minutes (default is 15)\nDefaults timestamp_timeout=5\n\n# Require password for sudo even if user has NOPASSWD elsewhere\nDefaults:jsmith !authenticate\n```\n\n```bash\n# Validate sudoers syntax without applying\nvisudo -c\n\n# Check what sudo permissions a user has\nsudo -l -U jsmith\n\n# Test a specific sudo command as a user\nsudo -u myapp \u002Fopt\u002Fmyapp\u002Fbin\u002Fhealthcheck.sh\n```\n\n## File Permissions and ACLs\n\n```bash\n# Standard permissions\nchmod 755 \u002Fopt\u002Fmyapp           # rwxr-xr-x\nchmod 640 \u002Fetc\u002Fmyapp.conf      # rw-r-----\nchmod u+x script.sh            # Add execute for owner\nchmod g+w shared-dir\u002F          # Add write for group\nchmod o-rwx private-file       # Remove all permissions for others\n\n# Change ownership\nchown deploy:developers \u002Fopt\u002Fmyapp\nchown -R deploy:developers \u002Fopt\u002Fmyapp\u002F   # Recursive\n\n# Set the SGID bit (new files inherit group ownership)\nchmod g+s \u002Fopt\u002Fshared\u002F\n\n# Set the sticky bit (only owner can delete their files)\nchmod +t \u002Ftmp\u002Fshared\u002F\n\n# Access Control Lists (ACLs) for fine-grained control\n# Grant read-execute to a specific user on a directory\nsetfacl -m u:jsmith:rx \u002Fopt\u002Fmyapp\u002Flogs\u002F\n\n# Grant read-write to a group\nsetfacl -m g:developers:rw \u002Fopt\u002Fshared\u002F\n\n# Set default ACL (applied to new files created in the directory)\nsetfacl -d -m g:developers:rw \u002Fopt\u002Fshared\u002F\n\n# View ACLs\ngetfacl \u002Fopt\u002Fshared\u002F\n\n# Remove a specific ACL entry\nsetfacl -x u:jsmith \u002Fopt\u002Fmyapp\u002Flogs\u002F\n\n# Remove all ACLs\nsetfacl -b \u002Fopt\u002Fshared\u002F\n```\n\n## PAM Configuration\n\n```bash\n# PAM config files are in \u002Fetc\u002Fpam.d\u002F\n# Each file controls auth for a specific service (sshd, login, sudo, etc.)\n\n# Enforce password complexity via pam_pwquality\n# \u002Fetc\u002Fpam.d\u002Fcommon-password (Debian) or \u002Fetc\u002Fpam.d\u002Fsystem-auth (RHEL)\npassword requisite pam_pwquality.so retry=3 minlen=12 dcredit=-1 ucredit=-1 ocredit=-1 lcredit=-1\n\n# Configure \u002Fetc\u002Fsecurity\u002Fpwquality.conf\nminlen = 12\ndcredit = -1\nucredit = -1\nocredit = -1\nlcredit = -1\nmaxrepeat = 3\ndictcheck = 1\n\n# Limit concurrent logins per user\n# \u002Fetc\u002Fsecurity\u002Flimits.conf\njsmith hard maxlogins 3\n@developers hard maxlogins 5\n\n# Lock account after 5 failed login attempts\n# \u002Fetc\u002Fpam.d\u002Fcommon-auth (Debian)\nauth required pam_faillock.so preauth silent deny=5 unlock_time=900\nauth required pam_faillock.so authfail deny=5 unlock_time=900\n\n# View failed login attempts\nfaillock --user jsmith\n\n# Unlock a locked account\nfaillock --user jsmith --reset\n```\n\n## LDAP \u002F Active Directory Integration\n\n```bash\n# Install SSSD and realmd for AD integration (Ubuntu\u002FDebian)\napt install -y sssd realmd adcli sssd-tools libnss-sss libpam-sss\n\n# Install SSSD and realmd (RHEL\u002FCentOS)\ndnf install -y sssd realmd adcli sssd-tools oddjob oddjob-mkhomedir\n\n# Discover and join an Active Directory domain\nrealm discover corp.example.com\nrealm join corp.example.com -U admin@CORP.EXAMPLE.COM\n\n# Verify the join\nrealm list\n\n# Allow specific AD groups to log in\nrealm permit -g \"Linux Admins@corp.example.com\"\nrealm permit -g \"Developers@corp.example.com\"\n\n# Deny all except permitted groups\nrealm deny --all\nrealm permit -g \"Linux Admins@corp.example.com\"\n\n# Restart SSSD after config changes\nsystemctl restart sssd\n\n# Test LDAP user lookup\nid jsmith\ngetent passwd jsmith\n\n# Grant sudo to an AD group\necho '%linux\\ admins ALL=(ALL) ALL' > \u002Fetc\u002Fsudoers.d\u002Fad-admins\n```\n\n## Bulk User Management Scripts\n\n### Bulk User Creation from CSV\n\n```bash\n#!\u002Fbin\u002Fbash\n# bulk-create-users.sh\n# CSV format: username,fullname,groups,shell\n# Example: jsmith,Jane Smith,developers;docker,\u002Fbin\u002Fbash\n\nCSV_FILE=\"${1:?Usage: $0 \u003Cusers.csv>}\"\n\nwhile IFS=',' read -r username fullname groups shell; do\n  # Skip header line\n  [[ \"$username\" == \"username\" ]] && continue\n\n  if id \"$username\" &>\u002Fdev\u002Fnull; then\n    echo \"SKIP: User $username already exists\"\n    continue\n  fi\n\n  # Replace semicolons with commas for -G flag\n  group_list=\"${groups\u002F\u002F;\u002F,}\"\n\n  useradd -m -s \"$shell\" -c \"$fullname\" -G \"$group_list\" \"$username\"\n  # Generate a random temporary password\n  temp_pass=$(openssl rand -base64 12)\n  echo \"$username:$temp_pass\" | chpasswd\n  chage -d 0 \"$username\"   # Force password change at first login\n\n  echo \"CREATED: $username (groups: $group_list) temp-pass: $temp_pass\"\ndone \u003C \"$CSV_FILE\"\n```\n\n### Quick Access Audit Commands\n\n```bash\n# List non-system users (UID >= 1000)\nawk -F: '$3 >= 1000 && $3 \u003C 65534 { printf \"%-20s UID=%-6s Shell=%s\\n\", $1, $3, $7 }' \u002Fetc\u002Fpasswd\n\n# List users with sudo access\ngetent group sudo wheel 2>\u002Fdev\u002Fnull\n\n# Find accounts that have never logged in\nlastlog | awk '$0 ~ \u002FNever logged in\u002F { print $1 }'\n\n# Find accounts with empty passwords\nawk -F: '($2 == \"\" || $2 == \"!\") { print $1 }' \u002Fetc\u002Fshadow 2>\u002Fdev\u002Fnull\n```\n\n## Troubleshooting\n\n| Symptom | Diagnostic Command | Common Fix |\n|---|---|---|\n| User cannot log in | `passwd -S username`, `faillock --user username` | Unlock account, reset password, check shell |\n| \"not in sudoers\" error | `sudo -l -U username` | Add user to sudo group or create sudoers.d file |\n| Group membership not applied | `id username`, `groups username` | User must log out and back in for new groups |\n| LDAP\u002FAD user not found | `id aduser`, `sssctl user-show aduser` | Check SSSD status, clear cache: `sss_cache -E` |\n| Permission denied on file | `ls -la file`, `getfacl file` | Fix ownership\u002Fpermissions, check SELinux context |\n| PAM lockout after failed attempts | `faillock --user username` | `faillock --user username --reset` |\n| Home directory not created | Check `\u002Fetc\u002Flogin.defs` CREATEHOME | Use `useradd -m` or enable `pam_mkhomedir` |\n| Password policy not enforced | Check `\u002Fetc\u002Fpam.d\u002Fcommon-password` | Install and configure `pam_pwquality` |\n\n## Related Skills\n\n- `linux-administration` -- General Linux server management\n- `ssh-configuration` -- SSH key-based authentication for managed users\n- `systemd-services` -- Service accounts and systemd user instances\n- `performance-tuning` -- Resource limits per user via cgroups and ulimits\n\n## Limitations\n\n- Infrastructure commands can disrupt services: confirm target host\u002Fscope and have backups\u002Fsnapshots before mutating state.\n- Docs-only import: upstream scripts and templates not bundled.\n\n","# User Management\n\nManage users, groups, permissions, sudo access, PAM modules, and LDAP integration on Linux systems. Includes practical scripts for bulk user operations and access auditing.\n\n## When to Use\n\n- Creating and managing local user accounts on Linux servers\n- Configuring sudo access with fine-grained privilege controls\n- Setting up group-based access control for teams\n- Integrating Linux hosts with LDAP or Active Directory for centralized auth\n- Auditing user accounts, permissions, and access patterns\n- Automating bulk user provisioning and deprovisioning\n\n## Prerequisites\n\n- Root or sudo access on the target system\n- `shadow-utils` package (provides useradd, usermod, etc.) -- installed by default\n- `libpam-modules` for PAM configuration\n- For LDAP: `sssd`, `realmd`, `libpam-ldapd`, or `nslcd` packages\n- For auditing: `auditd` package\n\n## User Operations\n\n### Creating Users\n\n```bash\n# Create a user with home directory, default shell, and comment\nuseradd -m -s \u002Fbin\u002Fbash -c \"Jane Smith\" jsmith\n\n# Set the user's password interactively\npasswd jsmith\n\n# Create a user with a specific UID and primary group\nuseradd -m -s \u002Fbin\u002Fbash -u 1500 -g developers -c \"Deploy Account\" deploy\n\n# Create a system account (no home, no login shell) for running services\nuseradd -r -s \u002Fusr\u002Fsbin\u002Fnologin -d \u002Fopt\u002Fmyapp -c \"MyApp Service Account\" myapp\n\n# Create a user with an expiration date (contractor access)\nuseradd -m -s \u002Fbin\u002Fbash -e 2025-12-31 -c \"Contractor - Bob Lee\" blee\n\n# Create user and add to multiple supplementary groups at creation time\nuseradd -m -s \u002Fbin\u002Fbash -G docker,developers,ssh-users -c \"Dev User\" devuser\n```\n\n### Modifying Users\n\n```bash\n# Add a user to a supplementary group (preserving existing groups with -a)\nusermod -aG sudo jsmith\nusermod -aG docker,developers jsmith\n\n# Change the user's login shell\nusermod -s \u002Fbin\u002Fzsh jsmith\n\n# Change the user's home directory and move existing files\nusermod -d \u002Fhome\u002Fjsmith-new -m jsmith\n\n# Lock a user account (disable login without deleting)\nusermod -L jsmith\n\n# Unlock a user account\nusermod -U jsmith\n\n# Set an account expiration date\nusermod -e 2025-06-30 blee\n\n# Change a user's login name\nusermod -l jsmith-new jsmith\n\n# Force password change on next login\nchage -d 0 jsmith\n\n# Set password aging: min 7 days, max 90 days, warn 14 days before\nchage -m 7 -M 90 -W 14 jsmith\n\n# View password aging info\nchage -l jsmith\n```\n\n### Deleting Users\n\n```bash\n# Remove a user and their home directory\nuserdel -r jsmith\n\n# Remove a user but keep their home directory (for auditing)\nuserdel jsmith\n\n# Find and reassign files owned by a deleted user (by UID)\nfind \u002F -uid 1500 -exec chown newowner:newgroup {} \\;\n```\n\n## Group Management\n\n```bash\n# Create a new group\ngroupadd developers\n\n# Create a group with a specific GID\ngroupadd -g 2000 devops\n\n# Add a user to a group\nusermod -aG developers jsmith\n# Alternative using gpasswd\ngpasswd -a jsmith developers\n\n# Remove a user from a group\ngpasswd -d jsmith developers\n\n# Set group administrators (can add\u002Fremove members without root)\ngpasswd -A jsmith developers\n\n# Delete a group\ngroupdel developers\n\n# List all groups a user belongs to\ngroups jsmith\nid jsmith\n\n# List all members of a group\ngetent group developers\n\n# Show all groups on the system\ncat \u002Fetc\u002Fgroup | cut -d: -f1 | sort\n```\n\n## Sudo Configuration\n\n```bash\n# Always edit sudoers via visudo (syntax validation prevents lockout)\nvisudo\n\n# Better: use drop-in files in \u002Fetc\u002Fsudoers.d\u002F\nvisudo -f \u002Fetc\u002Fsudoers.d\u002Fdevelopers\n```\n\n### \u002Fetc\u002Fsudoers.d\u002Fdevelopers\n\n```text\n# Allow the developers group to restart specific services\n%developers ALL=(ALL) NOPASSWD: \u002Fusr\u002Fbin\u002Fsystemctl restart myapp, \u002Fusr\u002Fbin\u002Fsystemctl status myapp\n\n# Allow a deploy user full sudo with no password\ndeploy ALL=(ALL) NOPASSWD: ALL\n\n# Allow ops team to run docker commands only\n%ops ALL=(ALL) NOPASSWD: \u002Fusr\u002Fbin\u002Fdocker, \u002Fusr\u002Fbin\u002Fdocker-compose\n\n# Allow a user to run commands as a specific service account\njsmith ALL=(myapp) NOPASSWD: \u002Fopt\u002Fmyapp\u002Fbin\u002F*\n\n# Restrict to specific hosts (useful with centralized sudoers)\njsmith dbservers=(root) \u002Fusr\u002Fbin\u002Fsystemctl restart postgresql\n\n# Log all sudo commands to a dedicated file\nDefaults log_output\nDefaults!\u002Fusr\u002Fbin\u002Fsudoreplay !log_output\nDefaults logfile=\"\u002Fvar\u002Flog\u002Fsudo.log\"\n\n# Require password re-entry every 5 minutes (default is 15)\nDefaults timestamp_timeout=5\n\n# Require password for sudo even if user has NOPASSWD elsewhere\nDefaults:jsmith !authenticate\n```\n\n```bash\n# Validate sudoers syntax without applying\nvisudo -c\n\n# Check what sudo permissions a user has\nsudo -l -U jsmith\n\n# Test a specific sudo command as a user\nsudo -u myapp \u002Fopt\u002Fmyapp\u002Fbin\u002Fhealthcheck.sh\n```\n\n## File Permissions and ACLs\n\n```bash\n# Standard permissions\nchmod 755 \u002Fopt\u002Fmyapp           # rwxr-xr-x\nchmod 640 \u002Fetc\u002Fmyapp.conf      # rw-r-----\nchmod u+x script.sh            # Add execute for owner\nchmod g+w shared-dir\u002F          # Add write for group\nchmod o-rwx private-file       # Remove all permissions for others\n\n# Change ownership\nchown deploy:developers \u002Fopt\u002Fmyapp\nchown -R deploy:developers \u002Fopt\u002Fmyapp\u002F   # Recursive\n\n# Set the SGID bit (new files inherit group ownership)\nchmod g+s \u002Fopt\u002Fshared\u002F\n\n# Set the sticky bit (only owner can delete their files)\nchmod +t \u002Ftmp\u002Fshared\u002F\n\n# Access Control Lists (ACLs) for fine-grained control\n# Grant read-execute to a specific user on a directory\nsetfacl -m u:jsmith:rx \u002Fopt\u002Fmyapp\u002Flogs\u002F\n\n# Grant read-write to a group\nsetfacl -m g:developers:rw \u002Fopt\u002Fshared\u002F\n\n# Set default ACL (applied to new files created in the directory)\nsetfacl -d -m g:developers:rw \u002Fopt\u002Fshared\u002F\n\n# View ACLs\ngetfacl \u002Fopt\u002Fshared\u002F\n\n# Remove a specific ACL entry\nsetfacl -x u:jsmith \u002Fopt\u002Fmyapp\u002Flogs\u002F\n\n# Remove all ACLs\nsetfacl -b \u002Fopt\u002Fshared\u002F\n```\n\n## PAM Configuration\n\n```bash\n# PAM config files are in \u002Fetc\u002Fpam.d\u002F\n# Each file controls auth for a specific service (sshd, login, sudo, etc.)\n\n# Enforce password complexity via pam_pwquality\n# \u002Fetc\u002Fpam.d\u002Fcommon-password (Debian) or \u002Fetc\u002Fpam.d\u002Fsystem-auth (RHEL)\npassword requisite pam_pwquality.so retry=3 minlen=12 dcredit=-1 ucredit=-1 ocredit=-1 lcredit=-1\n\n# Configure \u002Fetc\u002Fsecurity\u002Fpwquality.conf\nminlen = 12\ndcredit = -1\nucredit = -1\nocredit = -1\nlcredit = -1\nmaxrepeat = 3\ndictcheck = 1\n\n# Limit concurrent logins per user\n# \u002Fetc\u002Fsecurity\u002Flimits.conf\njsmith hard maxlogins 3\n@developers hard maxlogins 5\n\n# Lock account after 5 failed login attempts\n# \u002Fetc\u002Fpam.d\u002Fcommon-auth (Debian)\nauth required pam_faillock.so preauth silent deny=5 unlock_time=900\nauth required pam_faillock.so authfail deny=5 unlock_time=900\n\n# View failed login attempts\nfaillock --user jsmith\n\n# Unlock a locked account\nfaillock --user jsmith --reset\n```\n\n## LDAP \u002F Active Directory Integration\n\n```bash\n# Install SSSD and realmd for AD integration (Ubuntu\u002FDebian)\napt install -y sssd realmd adcli sssd-tools libnss-sss libpam-sss\n\n# Install SSSD and realmd (RHEL\u002FCentOS)\ndnf install -y sssd realmd adcli sssd-tools oddjob oddjob-mkhomedir\n\n# Discover and join an Active Directory domain\nrealm discover corp.example.com\nrealm join corp.example.com -U admin@CORP.EXAMPLE.COM\n\n# Verify the join\nrealm list\n\n# Allow specific AD groups to log in\nrealm permit -g \"Linux Admins@corp.example.com\"\nrealm permit -g \"Developers@corp.example.com\"\n\n# Deny all except permitted groups\nrealm deny --all\nrealm permit -g \"Linux Admins@corp.example.com\"\n\n# Restart SSSD after config changes\nsystemctl restart sssd\n\n# Test LDAP user lookup\nid jsmith\ngetent passwd jsmith\n\n# Grant sudo to an AD group\necho '%linux\\ admins ALL=(ALL) ALL' > \u002Fetc\u002Fsudoers.d\u002Fad-admins\n```\n\n## Bulk User Management Scripts\n\n### Bulk User Creation from CSV\n\n```bash\n#!\u002Fbin\u002Fbash\n# bulk-create-users.sh\n# CSV format: username,fullname,groups,shell\n# Example: jsmith,Jane Smith,developers;docker,\u002Fbin\u002Fbash\n\nCSV_FILE=\"${1:?Usage: $0 \u003Cusers.csv>}\"\n\nwhile IFS=',' read -r username fullname groups shell; do\n  # Skip header line\n  [[ \"$username\" == \"username\" ]] && continue\n\n  if id \"$username\" &>\u002Fdev\u002Fnull; then\n    echo \"SKIP: User $username already exists\"\n    continue\n  fi\n\n  # Replace semicolons with commas for -G flag\n  group_list=\"${groups\u002F\u002F;\u002F,}\"\n\n  useradd -m -s \"$shell\" -c \"$fullname\" -G \"$group_list\" \"$username\"\n  # Generate a random temporary password\n  temp_pass=$(openssl rand -base64 12)\n  echo \"$username:$temp_pass\" | chpasswd\n  chage -d 0 \"$username\"   # Force password change at first login\n\n  echo \"CREATED: $username (groups: $group_list) temp-pass: $temp_pass\"\ndone \u003C \"$CSV_FILE\"\n```\n\n### Quick Access Audit Commands\n\n```bash\n# List non-system users (UID >= 1000)\nawk -F: '$3 >= 1000 && $3 \u003C 65534 { printf \"%-20s UID=%-6s Shell=%s\\n\", $1, $3, $7 }' \u002Fetc\u002Fpasswd\n\n# List users with sudo access\ngetent group sudo wheel 2>\u002Fdev\u002Fnull\n\n# Find accounts that have never logged in\nlastlog | awk '$0 ~ \u002FNever logged in\u002F { print $1 }'\n\n# Find accounts with empty passwords\nawk -F: '($2 == \"\" || $2 == \"!\") { print $1 }' \u002Fetc\u002Fshadow 2>\u002Fdev\u002Fnull\n```\n\n## Troubleshooting\n\n| Symptom | Diagnostic Command | Common Fix |\n|---|---|---|\n| User cannot log in | `passwd -S username`, `faillock --user username` | Unlock account, reset password, check shell |\n| \"not in sudoers\" error | `sudo -l -U username` | Add user to sudo group or create sudoers.d file |\n| Group membership not applied | `id username`, `groups username` | User must log out and back in for new groups |\n| LDAP\u002FAD user not found | `id aduser`, `sssctl user-show aduser` | Check SSSD status, clear cache: `sss_cache -E` |\n| Permission denied on file | `ls -la file`, `getfacl file` | Fix ownership\u002Fpermissions, check SELinux context |\n| PAM lockout after failed attempts | `faillock --user username` | `faillock --user username --reset` |\n| Home directory not created | Check `\u002Fetc\u002Flogin.defs` CREATEHOME | Use `useradd -m` or enable `pam_mkhomedir` |\n| Password policy not enforced | Check `\u002Fetc\u002Fpam.d\u002Fcommon-password` | Install and configure `pam_pwquality` |\n\n## Related Skills\n\n- `linux-administration` -- General Linux server management\n- `ssh-configuration` -- SSH key-based authentication for managed users\n- `systemd-services` -- Service accounts and systemd user instances\n- `performance-tuning` -- Resource limits per user via cgroups and ulimits\n\n## Limitations\n\n- Infrastructure commands can disrupt services: confirm target host\u002Fscope and have backups\u002Fsnapshots before mutating state.\n- Docs-only import: upstream scripts and templates not bundled.\n\n",{"name":5,"risk":25,"source":43,"license":14,"category":44,"metadata":45,"date_added":48,"description":7,"source_repo":49,"source_type":29,"compatibility":50,"license_source":51},"https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills","devops",{"author":46,"version":47},"devops-skills","1.0","2026-09-20","BagelHole\u002FDevOps-Security-Agent-Skills","Requires the relevant OS\u002Fplatform tooling and privileged access where noted. Docs-only; helper scripts and templates not bundled.","https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE","f3312ba749561b6159f477dbfc9313c875d40a56",".agents\u002Fskills_archive\u002Fuser-management","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612","2026-10-25 23:50:58",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill user-management",{"tool":63,"command":64},"bunx","bunx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill user-management",{"tool":66,"command":67},"pnpm","pnpm dlx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill user-management","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fuser-management\u002FSKILL.md",true,[],[72,94,118,143,171,195],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":83,"publishedAt":38},"01M6Q0FA5FZ410Z33Z3TFQ4DBA","zero-trust","Implement zero-trust network architecture. Configure identity-based access, micro-segmentation, and continuous verification. Use when implementing modern security architectures.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzero-trust\u002FSKILL.md",[78],{"categoryNo":79,"categoryName":80,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000011","运维与部署","SCENARIO","使用场景",[84,85,86,87,88,89,74,90,35,34,33,31,29,28,91,25,92,24,23,93],"ZeRO","trust","zero trust","architecture","assessment","verification","segmentation","active","scope","implementing",{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":38},"01M6Q0F1YZJW3KX5FBKEVZ8CV4","zcode-delegate","Delegate coding tasks to the Z.AI ZCode CLI only when the user explicitly requests it, while the orchestrator retains review and landing responsibility.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzcode-delegate\u002FSKILL.md",[],[101,102,103,104,105,106,107,108,109,110,111,112,113,31,114,29,115,116,25,117],"delegate","zcode","zcode delegate","review","cli","orchestration","tasks","run","Bash","model","node","read","orchestrator","files","desktop app","app","agent-orchestration",{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":38},"01M6Q0ETK41VGNMYEXW0T00AJN","youtube-transcript","Fetch YouTube transcripts through DeepAPI or local fallback tooling and save clean text output.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript\u002FSKILL.md",[],[125,126,127,128,129,130,131,132,133,134,135,136,137,29,28,138,139,140,141,142],"transcript","youtube transcript","youtube","safe","github","codex","research","license","https","text","fetch","tooling","clean","local","output","deepapi","youtube transcripts","blob",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":160,"publishedAt":38},"01M6Q0EPPH2PVMDW40017F8WX0","youtube-transcript-skills","Fetch YouTube video transcripts, search videos\u002Fchannels, browse channels, and extract playlists via the getyoutubetranscript.com API - free tier, no card required.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript-skills\u002FSKILL.md",[149,152,155],{"categoryNo":150,"categoryName":151,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":153,"categoryName":154,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":156,"categoryName":157,"taxonomyType":158,"taxonomyTypeDesc":159},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[125,126,127,161,128,162,129,130,132,163,164,165,166,135,167,29,28,168,169,170],"youtube transcript skills","gemini","search","api","Video","browse","api-integration","free","card","channels",{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":175,"categories":176,"keywords":181,"publishedAt":38},"01M6Q0EAB96PX83W5PTE8A0R8D","youtube-notetaker","Turn YouTube talks into local study notes with slides, transcripts, editable annotations, and a markdown-backed viewer.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-notetaker\u002FSKILL.md",[177,180],{"categoryNo":178,"categoryName":179,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":153,"categoryName":154,"taxonomyType":81,"taxonomyTypeDesc":82},[127,182,183,105,128,184,185,186,187,132,165,188,189,190,191,28,192,138,193,194],"youtube notetaker","notetaker","workflow","official","notes","code","markdown","slides","annotations","README","study","dair-academy","viewer",{"skillNo":196,"name":197,"nameZh":6,"description":198,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":199,"categories":200,"keywords":202,"publishedAt":38},"01M6Q0E55F0GW5MX48V8HXS8B5","youtube-full","Fetch YouTube transcripts, search videos, browse channels, and extract playlists via TranscriptAPI — no yt-dlp, no Google API key, works from any cloud server.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-full\u002FSKILL.md",[201],{"categoryNo":150,"categoryName":151,"taxonomyType":81,"taxonomyTypeDesc":82},[203,127,204,205,128,162,163,206,207,164,165,166,135,208,167,29,28,168,209,141],"youtube full","full","google","server","dlp","credits","automatic"]