ShellSpells
  • 🧙‍♂️Welcome!
    • ShellSpells
    • FAQs
    • License & Disclaimer
  • 🐧Linux
    • System Ops
      • Transcripts
      • Help
      • System Info
        • Date/Time
        • System Details
        • Patches & Updates
        • Init System Identification
        • Hostname / Host ID
        • Variables
        • Hardware & Resources
      • Filesystem
        • Traverse & Enumerate
        • Drives & Partitions
        • Shares
        • Packages
        • Connected Devices
        • Kernel Modules (Drivers)
      • Users & Groups
        • Enumerate
        • Modify
      • Network
        • Enumerate
        • Modify
      • Scheduled Jobs
        • Enumerate
        • Modify
      • Processes
        • Enumerate
        • Modify
        • Custom Script and Shared Object
        • Process I/O Redirection
      • Services
        • Enumerate
        • Modify
        • Create a Service
      • Startup/Boot Scripts
        • Enumerate
        • Modify
      • Security
        • Antivirus
        • Firewall
        • SSH Keys
      • History & Logs
        • History
        • Logs
    • File Ops
      • Search
        • Filename
        • Content
        • Users (Owners)
        • Time
        • Size
        • Permission
        • Hidden Files
        • Inode
        • Find + Exec
        • Notes
      • Enumerate Metadata
      • Modify Metadata
      • Read Content
      • Modify Content
      • Extract Content
      • Sort / Compare / Count
      • Move
      • Copy
      • Execute
      • Hash
      • Encode/Decode
      • Compress/Decompress
      • Working With Weird Filenames
    • Terminal Ops
      • Keyboard Shortcuts
      • Tmux Shortcuts
  • 🪟Windows
    • System Ops
      • Transcripts
      • Help
      • System Info
        • One-liners
        • Date/Time
        • System Details
        • Hotfixes
        • Domain or Workgroup
        • Data Execution Prevention
        • Variables
        • Hardware & Resources
      • Filesystem
        • Traverse & Enumerate
        • Drives & Partitions
        • Installed Software
        • Drivers
        • Shares
      • Registry
        • Enumerate
        • Modify
        • Forensically Relevant Keys
      • Users & Groups
        • Enumerate
        • Modify
      • Network
        • Enumerate
        • Modify
      • Scheduled Tasks
      • Processes
        • Enumerate
        • Modify
      • Services
        • Enumerate
        • Modify
      • Autorun / Startup
        • Enumerate
        • Modify
      • Security
        • Permissions
          • Enumerate
          • Page
        • Antivirus
        • Firewall
          • Enumerate
          • Modify
        • Audit Policies
        • Remoting
          • Enumerate
          • Modify
          • Registry Locations
        • Stored Credentials
      • Remote Command Execution
      • Active Directory
        • Enumerate
        • Modify
      • History & Logs
        • History
        • Logs
      • PowerShell Config
      • Scripting
      • WMIC Notes
    • File Ops
      • Search
        • Filename
        • Time
        • Size
        • Permissions
        • Attributes
        • Wildcarding
      • Enumerate Metadata
        • One Liners
        • Users (Owners)
        • Timestamps
        • Size
        • Permissions
        • Attributes
      • Modify Metadata
        • Change Owner
        • Timestamps
        • Size
        • Attributes
      • Read Content
      • Modify Content
        • Overwrite
        • Insert
        • Append
        • Replace / Remove
        • Convert Case
        • Alternate Data Streams
      • Extract Content
      • Sort / Compare / Count
        • Sort
        • Count
        • Compare
      • Move
      • Copy
      • Execute
      • Hash
      • Encode/Decode
      • Compress/Decompress
      • Working With Weird Filenames
      • Output Formatting / Filtering
      • File Formatting
      • Operators
  • ⛓️Network
    • Traffic Manipulation
      • iptables
        • Option List
        • General Commands
        • Filter Tables
        • NAT
        • Mangle
        • Filter for SSH Traffic (Example)
      • nftables
    • Packet Capture
      • Syntax
      • TCPDump Examples
    • Packet Analysis
      • Wireshark
  • 🚗Maneuver
    • SSH
    • Control Sockets
    • RDP
    • Windows Port Proxy
  • 🛩️Data Transfer
    • SCP
    • FTP
    • Netcat
      • Netcat Relays
    • Server Interactions
    • Alternate Methods
  • 🪄REGEX
    • Examples
Powered by GitBook
On this page
  • User Accounts
  • Account Management
  • Managing Group Membership
  • Password Policies
  • Groups
  • Group Management
  • Editing Config Files Directly

Was this helpful?

  1. Linux
  2. System Ops
  3. Users & Groups

Modify

User Accounts

Account Management

Command
Description

passwd <username>

Change user password (requires root privileges).

useradd <username>

Create a new user account (requires root privileges).

userdel <username>

Delete an existing user account (requires root privileges).

usermod <username>

Modify various user account settings (requires root privileges).

chfn <options> <username>

Changes the user's finger information (real name, office, phone, etc.).

chsh <options> <username>

Changes the user's login shell.

passwd -l <username>

Lock a user account, preventing login (requires root privileges).

passwd -u <username>

Unlock a locked user account (requires root privileges).

usermod -L <username>

Disable a user account (requires root privileges).

usermod -U <username>

Enable a disabled user account (requires root privileges).

Example: sudo useradd -m -d /home/username -s /bin/bash username

-m: Creates the user's home directory as specified by the -d option. If -d is not specified with -m, the home directory is created under the location specified in /etc/default/useradd or the default /home/username. -d /home/username: Specifies the home directory for the new user. -s /bin/bash: Sets the default shell for the user.

Managing Group Membership

usermod -G <group1>,<group2> <username>

Add/Remove user from specific groups (requires root privileges).

groups <username>

Check user's current group memberships.

usermod -aG <groupname> <username>

Adds a user to a group.

Password Policies

chapw

Manage system-wide password policies (requires root privileges).

chage -l <username>

Display password expiration info for user (requires root privileges).

chage <options> <username>

Changes user password expiry info.

Groups

Group Management

groupadd <groupname>

Creates a new group.

groupdel <groupname>

Deletes a group.

groupmod <options> <groupname>

Modifies a group's name or GID (Group ID).

gpasswd <options> <groupname>

Administers the /etc/group and /etc/gshadow files.

usermod -aG <groupname> <username>

Adds a user to a group. -aG appends the user to the supplemental groups.

vigr

Edits the /etc/group file in a safe manner, similar to using vipw.

vigr -s

Edits the /etc/gshadow file in a safe manner, managing secure group account information.

Editing Config Files Directly

While you can use commands like useradd, userdel, usermod, and passwd for user management, direct editing of /etc/passwd and /etc/shadow is sometimes necessary for manual adjustments. It's recommended to use vipw and vipw -s for editing these files to prevent file corruption and maintain system security. Always back up these files before making direct edits.

PreviousEnumerateNextNetwork

Last updated 1 year ago

Was this helpful?

🐧