Date: Sat, 16 Dec 2017 11:40:58 +0200 From: Dmytro Bilokha <dmytro@posteo.net> To: freebsd-ports@freebsd.org Subject: Setting system user home directory Message-ID: <20171216094058.GA37778@wstan>
next in thread | raw e-mail | index | archive | help
Hello, Everyone! I'm trying to change www/payara port to make it run under the payara user instead of root. I've added the following line to the UIDs file: payara:*:221:221::0:0:Payara Application Server user:/nonexistent:/usr/sbin/nologin And this line to the port makefile: USERS= payara Also, I've made some another changes to the port's scripts to start service under payara user. Everything seems to be fine, but the service on start/shutdown creates some preferences files, caches, etc in the payara user's homedir. The problem is, that it is impossible to create these files in /nonexistent. This fact makes service to show some annoying warnings on every startup/shutdown. To make service to work properly I want to create directory writable by the payara user and set it as payara's homedir. And I don't want to put these dir under the /usr/home/, it should be somewhere in the application, like /usr/local/payara-4.1.2.173/prefs. As far as I understand, payara user will be created automatically by the bsd.port.pre.mk file included in the port's makefile. But, during every installation somehow payara user's homedir should be changed. I can do it with the following one-liner: /usr/sbin/pw usermod payara -d ${DATADIR}/prefs So, the questions are: 1. Is it a proper way of doing such kind of things? 2. Where in the port's makefile should I put my one-liner? Will it be OK to make it like this: .......head of the make file with setting variables and so on is here...... .include <bsd.port.pre.mk> do-install: .........doing some work here...... @/usr/sbin/pw usermod payara -d ${DATADIR}/prefs .include <bsd.port.post.mk> ....end of the makefile..... Many thanks for your attention and help. -- Dmytro Bilokha dmytro@posteo.net +38-050-607-41-43
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171216094058.GA37778>