↑ ↓ select, Enter open, Esc close

#users

15 one-liners with this tag.

All one-liners tagged users

Change the role of a WordPress user

$wp user set-role editorial editor --path=/var/www/vhosts/example.com/httpdocs
cautionWP-CLI

Count processes per user

$ps -eo user= | sort | uniq -c | sort -rn
harmlessProcesses

Create a MySQL database with its own user

#mysql -e "CREATE DATABASE wp_example CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'wp_example_user'@'localhost' IDENTIFIED BY 'SecurePassword'; GRANT ALL PRIVILEGES ON wp_example.* TO 'wp_example_user'@'localhost';"
cautionMySQL and MariaDB

Create a new WordPress administrator

$wp user create emergencyadmin admin@example.com --role=administrator --path=/var/www/vhosts/example.com/httpdocs
cautionWP-CLI

Find accounts with UID 0 and root privileges

$awk -F: '$3 == 0 {print $1}' /etc/passwd
harmlessSecurity

Find the system user of each domain in Plesk

#plesk db "SELECT d.name, s.login FROM domains d JOIN hosting h ON h.dom_id = d.id JOIN sys_users s ON s.id = h.sys_user_id ORDER BY d.name"
harmlessPlesk

List all MySQL users with their host

#mysql -e 'SELECT user, host FROM mysql.user ORDER BY user;'
harmlessMySQL and MariaDB

List all WordPress administrators

$wp user list --role=administrator --fields=ID,user_login,user_email,user_registered --path=/var/www/vhosts/example.com/httpdocs
harmlessWP-CLI

List all WordPress users with their roles

$wp user list --fields=ID,user_login,user_email,roles --path=/var/www/vhosts/example.com/httpdocs
harmlessWP-CLI

List the members of the sudo group

$getent group sudo
harmlessSecurity

List user accounts with a login shell

$awk -F: '$7 !~ /(nologin|false)$/ {print $1, $3, $6, $7}' /etc/passwd
harmlessSecurity

Reset a WordPress user password

$wp user update admin --user_pass=NewSecurePassword --path=/var/www/vhosts/example.com/httpdocs
cautionWP-CLI

Show recently registered WordPress users

$wp user list --orderby=registered --order=DESC --fields=ID,user_login,user_email,user_registered,roles --path=/var/www/vhosts/example.com/httpdocs | head -n 15
harmlessWP-CLI

Show the password status of all user accounts

#passwd -S -a
harmlessSecurity

Show the privileges of a MySQL user

#mysql -e "SHOW GRANTS FOR 'dbuser'@'localhost';"
harmlessMySQL and MariaDB

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.