To create a Postgres user sam and a database samdb that is owned by the sam user:
$ su - postgres $ createuser -P -A -D sam $ createdb -O sam samdb
(Change the -A, and -D options to affect the new user's abilities.)
Edit the user's password with:
template1=# alter user username_here with password 'password_here';
accountcommandscreatedbcreateuserpermissionspostgresqluser
For example, to display the 20 largest files owned by joe:
find / -printf "%k\t%p\n" -user joe | sort -n | tail -20
commandsfilesfindpermissionsprintfsorttailusers
To create a new database:
$ mysqladmin create <database_name>
To grant permissions to a user, run this:
$ mysql -u root -p Password: (enter password) mysql> GRANT ALL ON db_name.* TO username@localhost IDENTIFIED BY "userpasswd";
To flush the privilege tables, run this:
$ mysqladmin flush-privileges
or:
mysql> flush privileges;
To revoke the privileges from a particular user/host pair:
mysql> revoke all privileges, grant option from username;
commandsgotchamysqlmysqladminpermissionsrevokesql
You can use the lsof (LiSt Open Files) utility to view information about which processes own file handles on a system. Since sockets map to file descriptors, lsof will show you which processes own socket connections. If you see that your machine is connected to another on TCP port 6234 (source or dest) and you want to find out which process(es) are responsible for the connection, run:
# lsof -ni tcp:6234
Note that when run as an unprivileged user, lsof will only show you file descriptors that you have permission to see. You must run lsof as root to see everything in the kernel.
commandsconnectionsdebuggingdescriptorsfilesystemlsofmonitoringnetworkpermissionsprocesssocketsutilities