#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
Count processes per user
$ps -eo user= | sort | uniq -c | sort -rn
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';"
Create a new WordPress administrator
$wp user create emergencyadmin admin@example.com --role=administrator --path=/var/www/vhosts/example.com/httpdocs
Find accounts with UID 0 and root privileges
$awk -F: '$3 == 0 {print $1}' /etc/passwd
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"
List all MySQL users with their host
#mysql -e 'SELECT user, host FROM mysql.user ORDER BY user;'
List all WordPress administrators
$wp user list --role=administrator --fields=ID,user_login,user_email,user_registered --path=/var/www/vhosts/example.com/httpdocs
List all WordPress users with their roles
$wp user list --fields=ID,user_login,user_email,roles --path=/var/www/vhosts/example.com/httpdocs
List the members of the sudo group
$getent group sudo
List user accounts with a login shell
$awk -F: '$7 !~ /(nologin|false)$/ {print $1, $3, $6, $7}' /etc/passwd
Reset a WordPress user password
$wp user update admin --user_pass=NewSecurePassword --path=/var/www/vhosts/example.com/httpdocs
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
Show the password status of all user accounts
#passwd -S -a
Show the privileges of a MySQL user
#mysql -e "SHOW GRANTS FOR 'dbuser'@'localhost';"