From owner-freebsd-ports@freebsd.org Sat Dec 16 13:59:27 2017 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 895EDE82FF0 for ; Sat, 16 Dec 2017 13:59:27 +0000 (UTC) (envelope-from dmytro@posteo.net) Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.posteo.de", Issuer "StartCom Class 3 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 21AC56493D for ; Sat, 16 Dec 2017 13:59:26 +0000 (UTC) (envelope-from dmytro@posteo.net) Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id C330B20DF5 for ; Sat, 16 Dec 2017 14:59:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1513432762; bh=JKv2FX4BWVavUSPEu0+0G6Mzj46NAzAoPS6I8bN/lRE=; h=Date:From:To:Cc:Subject:From; b=KkbbvmC0CsOo7eWaL2FZl7FTS8Czpn5wsG3Kv9fxMnNRE8jAfyCauWf8VUWrBth1x ZTrQnepivD9pbmHCOjLptTm/m4uDAGnJUdST3sJJUQMJRU0sNFbhXNR5UfmXz5/+hN otJ3VWmQD5WQCe+5kX/VnAK7dyl6jXkegILObGfkj0cDorL399vKPsBlt6ih8UCHw8 ziFqVPfzw5AtaphdDcSRENcUbkZmO8saIjlJ41qDHGsRKe1UEKCkRNH549WzIBqJOs +5Loej1Nhcr6RrejEpEM1ry+MU/OVg5vlOinl9mK/vUJSedOa41EiN/fRGkoE4A3Ah uFfSnLHJ5k1ZA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3yzTS96BBzz9rxG; Sat, 16 Dec 2017 14:59:21 +0100 (CET) Date: Sat, 16 Dec 2017 15:59:20 +0200 From: Dmytro Bilokha To: Miroslav Lachman <000.fbsd@quip.cz> Cc: freebsd-ports@freebsd.org Subject: Re: Setting system user home directory Message-ID: <20171216135919.GA17551@wstan> References: <20171216094058.GA37778@wstan> <5A351515.1080805@quip.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <5A351515.1080805@quip.cz> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Dec 2017 13:59:27 -0000 On Sat, Dec 16, 2017 at 01:44:05PM +0100, Miroslav Lachman wrote: >Dmytro Bilokha wrote on 2017/12/16 10:40: >> 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 >> do-install: >> .........doing some work here...... >> @/usr/sbin/pw usermod payara -d ${DATADIR}/prefs >> .include >> ....end of the makefile..... >> >> Many thanks for your attention and help. > >I don't know Payara but applications should not write its files to >/usr/local. This should work even if /usr/local is mounted Read Only. >If you need to store configuration (preferences) then it should be in >/usr/local/etc/payara. >If the application writes some data files like databases, it goes under >/var/db/payara and log in to /var/log/payara.log or /var/log/payara >(directory) > >Miroslav Lachman Thanks for the information. Now I'm a little bit confused. I've checked and seems to me that nither www/tomcat85 (servlet container) nor www/glassfish and java/wildfly10 (application servers) ports follow this convention. All of them has directories for logs, configuration and Java applications under the /usr/local. Is there something special in Java servers ports? -- Dmytro Bilokha dmytro@posteo.net +38-050-607-41-43