Saturday, December 21, 2024

User Maintenance

Install through yum:

[root@localhost ~]# yum -y install openssl
or

Install through apt-get:

[root@localhost ~]# apt-get install openssl

Generate a MD5 crypt password from the command line:

[root@localhost ~]# openssl passwd -1 mypassword
$1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0

Change the password for the admin user:

[root@localhost ~]# export PGPASSWORD=vpnttgpass
[root@localhost ~]# psql vpnttgdb -h 127.0.0.1 -U vpnttg
psql (8.4.20)
Type "help" for help.

vpnttgdb=# UPDATE users SET password='$1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0' WHERE username='admin';
UPDATE 1
vpnttgdb=# SELECT * FROM users;
 userid | username |              password              | admin | timeout | name | email 
--------+----------+------------------------------------+-------+---------+------+-------
      2 | guest    | $1$6LNaoUPf$mLtTWaqCQ1x7tCPhM9XDI1 | f     |    3600 |      | 
      1 | admin    | $1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0 | t     |    3600 |      | 
(2 rows)

vpnttgdb=# \q
[root@localhost ~]#

Change the password for the guest user:

[root@localhost ~]# export PGPASSWORD=vpnttgpass
[root@localhost ~]# psql vpnttgdb -h 127.0.0.1 -U vpnttg
psql (8.4.20)
Type "help" for help.

vpnttgdb=# UPDATE users SET password='$1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0' WHERE username='guest';                                  
UPDATE 1
vpnttgdb=# SELECT * FROM users;
 userid | username |              password              | admin | timeout | name | email 
--------+----------+------------------------------------+-------+---------+------+-------
      1 | admin    | $1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0 | t     |    3600 |      | 
      2 | guest    | $1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0 | f     |    3600 |      | 
(2 rows)

vpnttgdb=# \q
[root@localhost ~]#

Add another admin user:

[root@localhost ~]# export PGPASSWORD=vpnttgpass
[root@localhost ~]# psql vpnttgdb -h 127.0.0.1 -U vpnttg
psql (8.4.20)
Type "help" for help.

vpnttgdb=# INSERT INTO users (username, password, admin, name) VALUES ('admin1', '$1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0', 't', '');
INSERT 0 1
vpnttgdb=# select * from users;
 userid | username |              password              | admin | timeout | name | email 
--------+----------+------------------------------------+-------+---------+------+-------
      1 | admin    | $1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0 | t     |    3600 |      | 
      2 | guest    | $1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0 | f     |    3600 |      | 
      3 | admin1   | $1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0 | t     |    3600 |      | 
(3 rows)

vpnttgdb=# \q
[root@localhost ~]#

Add another guest user:

[root@localhost ~]# export PGPASSWORD=vpnttgpass
[root@localhost ~]# psql vpnttgdb -h 127.0.0.1 -U vpnttg
psql (8.4.20)
Type "help" for help.

vpnttgdb=# INSERT INTO users (username, password, name) VALUES ('guest1', '$1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0', '');     
INSERT 0 1
vpnttgdb=# SELECT * FROM users;
 userid | username |              password              | admin | timeout | name | email 
--------+----------+------------------------------------+-------+---------+------+-------
      1 | admin    | $1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0 | t     |    3600 |      | 
      2 | guest    | $1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0 | f     |    3600 |      | 
      3 | admin1   | $1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0 | t     |    3600 |      | 
      4 | guest1   | $1$g7C35SFt$z4QTRgsUF7pKRTY5jbIZX0 | f     |    3600 |      | 
(4 rows)

vpnttgdb=# \q
[root@localhost ~]#