Ubuntu – Passwords for newly created users

authenticationpasswordpostgresqlUbuntuusers

I am fairly new to Linux and I have question regarding users. When I use the useradd command I don't specify a password. I must use the passwd command afterwards. Does this mean that the user is disabled until it is done?

I installed Postgresql with the apt-get command. Do I have to create a postgres-user and change ownership of the installed postgresql files? Or is this taken care of by the apt-get?

I see that the owner of some of the files is already postgres. However, how do I run the server as postgres? I don't know the password. Trying to do su postgres fails because of authentication failure.

Best Answer

When I use the useradd command I don't specify a password. [...] Does this mean that the user is disabled until it is done?

Yes, if you don't specify a password hash using useradd's option -p, password-based login to the newly created account will be locked until you set a password using passwd.

I installed Postgresql with the apt-get command. Do I have to create a postgres-user and change ownership of the installed postgresql files? Or is this taken care of by the apt-get?

The .deb packages apt-get downloads and allows you to install usually come with a script that takes care of all settings required by the program you are installing.

Trying to do su postgres fails because of authentication failure.

As Stefan already pointed out, run su postgres as root, e.g. by running sudo su postgres and entering your password.

Related Question