Archive for the tag 'users'

Command line utilities for managing users and groups

useradd, userm od, userdel > Standard utilities for adding, modifying, and deleting user accounts.
groupadd, groupmod,groupdel > Standard utilities for adding, modifying, and deleting groups.

gpasswd > Standard utility for administering the /etc/group configuration file.
pwck, grpck > Utilities that can be used for verification of the password, group,and associated shadow files.

pwconv, pwunconv > Utilities that can be used for the conversion of passwords to shadow passwords, or back from shadow passwords to standard passwords

Creating and editing users in MySQL from shell prompt.

First we need to login into MySQL server as root.

mysql -u root -p

Will be prompted for your MySQL root password (note this is not the same as the server root password).

mysql> create user ‘buddy@localhost’ identified by ‘new-password’;
Query OK, 0 rows affected (0.12 sec)

Next we need to flush the privileges which reloads the ‘user’ table in MySQL - do this each time you add or edit users.

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

To give the user buddy select permission on all the databases, this allows the user to read, but not edit and delete.

mysql> grant select on *.* to ‘buddy’@'localhost’;
Query OK, 0 rows affected (0.00 sec)

The GRANT statement enables system administrators to create MySQL user accounts and to grant rights to accounts. To use GRANT, you must have the GRANT OPTION privilege, and you must have the privileges that you are granting. The REVOKE statement is related and enables administrators to remove account privileges.

Email notification everytime users run “sudo” on Linux

For Redhat, Centos Systems make sure that sendmail is running on the machine and configured to send out emails.

Run

visudo

Add the following configuration in /etc/sudoers

visudo parses the sudoers file after the edit and will not save the changes if there is a syntax error.

Defaults mail_always
Defaults mailerpath=/usr/sbin/sendmail
Defaults mailto=”root@serverbuddies.com”
Defaults mailsub=”*** Command run via sudo on %h ***”
Defaults mailerflags=”-t”

Checking cpanel crontab user files.

Via root SSH access, either of the following commands may be used to list the contents:

# crontab -l -u username
# cat /var/spool/cron/username

usage: crontab

usage: crontab [-u user] file

crontab [-u user] { -e | -l | -r }
-e (edit user’s crontab)
-l (list user’s crontab)
-r (delete user’s crontab)
-i (prompt before deleting user’s crontab)

The database utility is used to manage databases and database users in Plesk through CLI. By using this utility, you can perform the following tasks:

* creating or deleting databases
* adding and removing database users
* adding or removing database access records for database users
* editing database user credentials
* setting charset for PostgreSQL databases

Example

The following command creates database buddies on a database server accessible at the IP address and port number 192.0.2.78:3838 and prints the created Plesk database ID:

# ./database –create buddies -domain example.com -server 192.0.2.78:3838 -print-id

To create the database buddies for the domain example.com on the local MySQL server:

# ./database –create buddies -domain example.com -type mysql

Next »