Posts tagged "user"

Change default shell for new users

If you have a system with lots of new users, you probably want to set the default shell to the one that most users prefer.

If you're using the useradd command, you can set default options in the file /etc/default/useradd.

Editing this file can be done by using useradd -D ...:

# set default shell for new users to bash
useradd -D -s /bin/bash

Check here for more information.

Get granted roles with psql

With psql, there is an easy way to check which roles are granted to a role: \du

henk=> CREATE ROLE accounting;
henk=> CREATE ROLE alex;
henk=> GRANT accounting TO alex;
henk=> \du accounting
             List of roles
 Role name  |  Attributes  | Member of
 accounting | Cannot login | {}

henk=> \du alex
              List of roles
 Role name |  Attributes  |  Member of
 alex      |              | {accounting}

Specify docker exec user

With docker exec, you can execute commands inside of running Docker containers. The --user flag allows you to declare the user to use inside the container.


$ docker run -d
$ docker exec -it --user postgres cf4bea1a /bin/bash
[email protected]:/$