ubuntuの場合、postgresユーザのホームディレクトリは /var/lib/postgresql 。
例えば .pgpass をここに置くと、postgres ユーザで psql を実行した場合でも読んでくれる。


例えば nginx、mysql のように PostgreSQL の実行ユーザである postgres のホームディレクトリは、
PostgreSQL の maintainer が決める。 /home/postgres というディレクトリは作られない。
PostgreSQLは, root の代わりに postgres ユーザを使ってり様々な処理をおこなう.


ubuntuの場合、PostgreSQLは /var/lib/postgresql にインストールされていて、
/var/lib/postgresql がホームディレクトリ。


postgres の起動パラメタとして データディレクトリ が指定されている。 (-D)

別の方法として、psql から SHOW data_directory を実行することで



Why Directory for postgres user does not appear inside the HOME directory in linux with other users? [closed]

That there is a dedicated user for PostgreSQL is a security measure, so the DB processes can run with that user’s (limited) priviledges instead of running as root.

Whether or not you can actually log on with that user, and what that user’s home directory should be, is the decision of the package maintainer / the Linux distribution in question. Since the postgresql user should not be (ab-) used as just another user (with own desktop settings, user data etc.), I wouldn’t question the wisdom of not giving it a home, but rather why he is enabled to log in in the first place.

Edit: Being ignorant of the fine print of PostgreSQL, and a bit confused by the wording of your question, I argued the general case. Ignacio pointed out that you had to actually break the system (unlock the user’s password with root priviledges) to even be able to log in as postgresql user. So the answer can be phrased even simpler:

The user does not have a directory in /home because you are not supposed to ever log in as that user. It’s for running the database processes without root priviledges, nothing else.

(Note that you could, using the same technique, log in as user man, or user lp, or user mail. You could, but it wouldn’t make sense, and unlocking those user’s passwords actually weakens the security of your system.)


Copyright© , 2024 AllRights Reserved Powered by AFFINGER4.