[
https://issues.apache.org/jira/browse/DIRSERVER-862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495648
]
Ole Ersoy commented on DIRSERVER-862:
-------------------------------------
Example of how JPackage adds
a System user to run Tomcat, along with
how it sets file permissions:
%pre
# Add the "tomcat" user and group
# we need a shell to be able to use su - later
if grep ^tomcat: /etc/group 1>/dev/null 2>/dev/null; then
echo Group tomcat already exists, not adding group
else
if grep :%{tcuid}: /etc/group 1>/dev/null 2>/dev/null; then
echo GID %{tcuid} already exists, not adding group
else
%{_sbindir}/groupadd -g %{tcuid} -r tomcat 2> /dev/null || :
fi
fi
if grep ^tomcat: /etc/passwd 1>/dev/null 2>/dev/null; then
echo User tomcat already exists, not adding user
else
if grep x:%{tcuid}: /etc/passwd 1>/dev/null 2>/dev/null; then
echo UID %{tcuid} already exists, not adding user
else
%{_sbindir}/useradd -c "Tomcat" -u %{tcuid} -g tomcat \
-s /bin/sh -r -d %{homedir} tomcat 2> /dev/null || :
fi
fi
Also - Here's a sampling of how JPackage assigns file
ownership:
# Directories with special permissions
%attr(775,root,tomcat) %dir %{appdir}
%attr(775,root,tomcat) %dir %{confdir}
%attr(775,root,tomcat) %dir %{tempdir}
%attr(775,root,tomcat) %dir %{workdir}
%attr(755,tomcat,tomcat) %dir %{logdir}
%attr(775,root,tomcat) %dir %{confdir}/Catalina
%attr(775,root,tomcat) %dir %{confdir}/Catalina/localhost
%attr(755,root,root) %{_bindir}/*
%attr(755,root,root) %{bindir}/*
%attr(755,root,root) %{_sysconfdir}/init.d/%{name}
%attr(644,root,tomcat) %config(noreplace) %{confdir}/catalina.policy
%attr(644,root,tomcat) %config(noreplace) %{confdir}/catalina.properties
%attr(660,root,tomcat) %config(noreplace) %{confdir}/jk2.properties
%attr(660,root,tomcat) %config(noreplace) %{confdir}/logging.properties
%attr(660,root,tomcat) %config(noreplace) %{confdir}/tomcat-users.xml
> Installing 1.0.1 with RPM as root forbid the server to be launched
> ------------------------------------------------------------------
>
> Key: DIRSERVER-862
> URL: https://issues.apache.org/jira/browse/DIRSERVER-862
> Project: Directory ApacheDS
> Issue Type: Bug
> Reporter: Emmanuel Lecharny
> Assigned To: Emmanuel Lecharny
> Priority: Blocker
> Fix For: 1.5.1, 1.0.2
>
>
> If one tries to launch the server after having installed it with root, the
> sevrer simply don't start (even if the daemon tells that it's OK).
> The script use the user to launch the server, leading to some Access Denied,
> as the rpm set all the directories to be owned by root.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.