users and groups

Setting Up Users and Groups

useradd -D – list all settings
useradd [Name of User] – Add user
passwd [Name of User] – Create Password
useradd -c “Full Name” [Name of User]

cat /etc/passwd – view user details
cat /etc/shadow – view user passwords

userdel -r [Name of User] – delete user
usermod -c “Full Name” [Name of User]

cat /etc/group
groupadd -r [Name of Group] – Added a group under 500
usermod -G [Name of Group] [Name of User] – ensure you add the user to all appropriate groups.
groups [Name of User] – list the groups the user is in

Change FTP password

cd /home
passwd username

List all FTP Users and Passwords

mysql -uadmin -p` cat /etc/psa/.psa.shadow` -Dpsa -e”SELECT REPLACE(sys_users.home,’/home/httpd/vhosts/’,”) AS domain, sys_users.login,accounts.password FROM sys_users LEFT JOIN accounts on sys_users.account_id=accounts.id ORDER BY sys_users.home ASC;”

List all Mail Users and Passwords on Server

mysql -uadmin -p` cat /etc/psa/.psa.shadow` -Dpsa -e”SELECT mail_name,name,password from mail LEFT JOIN domains on mail.dom_id = domains.id INNER JOIN accounts where mail.account_id = accounts.id;”

List all MySQL Users and Logins

mysql -uadmin -p` cat /etc/psa/.psa.shadow` -Dpsa -e” SELECT domains.name AS domain_name, data_bases.name AS database_name, db_users.login, accounts.password FROM data_bases, db_users, domains, accounts WHERE data_bases.dom_id = domains.id AND db_users.db_id = data_bases.id AND db_users.account_id =accounts.id ORDER BY domain_name;”