[ 
https://issues.apache.org/jira/browse/AMQ-9690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17943317#comment-17943317
 ] 

Rod Allen commented on AMQ-9690:
--------------------------------

using apache-activemq-5.16.8-bin.tar.gz as an example and unpacked in 
/opt/activemq/apache-activemq-5.16.8


{code:java}
[root@rocky8test default]# pwd
/etc/default
[root@rocky8test default]# grep USER activemq
ACTIVEMQ_USER="apache" {code}
symbolic link created
{code:java}
[root@rocky8test init.d]# pwd
/etc/init.d
[root@rocky8test init.d]# ll
total 24
lrwxrwxrwx. 1 root root    49 Apr 10 12:40 activemq -> 
/opt/activemq/apache-activemq-5.16.8/bin/activemq
-rw-r--r--. 1 root root 18434 Aug 10  2022 functions
-rw-r--r--. 1 root root  1161 Mar 11 04:46 README {code}
service created, enabled and started
{code:java}
[root@rocky8test apache-activemq-5.16.8]# chkconfig --add activemq
[root@rocky8test apache-activemq-5.16.8]# chkconfig activemq on
[root@rocky8test apache-activemq-5.16.8]# chkconfig

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.      If you want to list systemd services use 
'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.
activemq        0:off   1:off   2:on    3:on    4:on    5:on    6:off


{code}
resulting data directory created as root and cannot be written to by the apache 
user
{code:java}
[root@rocky8test apache-activemq-5.16.8]# service activemq start
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/lib/jvm/java-17/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and 
log4j.properties to get details
INFO: changing to user 'apache' to invoke java
-sh: line 2: /opt/activemq/apache-activemq-5.16.8//data/activemq.pid: 
Permission denied
INFO: pidfile created : 
'/opt/activemq/apache-activemq-5.16.8//data/activemq.pid' (pid '2573')
[root@rocky8test apache-activemq-5.16.8]# ll
total 18100
-rwxr-xr-x. 1 apache apache 18475162 Jan 30  2022 activemq-all-5.16.8.jar
drwxrwxr-x. 5 apache apache      188 Apr 10 14:13 bin
drwxr-xr-x. 2 apache apache     4096 Apr 10 11:59 conf
drwxr-xr-x  2 root   root          6 Apr 10 14:16 data
drwxr-xr-x. 2 apache apache       76 Apr 10 11:59 docs
drwxr-xr-x. 7 apache apache       71 Jan 30  2022 examples
drwxr-xr-x. 6 apache apache     4096 Apr 10 11:59 lib
-rw-r--r--. 1 apache apache    40581 Jan 30  2022 LICENSE
-rw-r--r--. 1 apache apache     3334 Jan 30  2022 NOTICE
-rw-r--r--. 1 apache apache     2611 Jan 30  2022 README.txt
drwxrwxr-x. 2 apache apache        6 Apr 10 13:06 tmp
drwxr-xr-x. 6 apache apache       95 Apr 10 11:59 webapps
drwxrwxr-x. 3 apache apache       18 Apr 10 11:59 webapps-demo
[root@rocky8test apache-activemq-5.16.8]# ll data
total 0
 {code}
 

> activemq always creates the data directory as root when run as an init.d 
> service
> --------------------------------------------------------------------------------
>
>                 Key: AMQ-9690
>                 URL: https://issues.apache.org/jira/browse/AMQ-9690
>             Project: ActiveMQ Classic
>          Issue Type: Bug
>          Components: Distribution
>    Affects Versions: 6.1.6, 5.18.7
>            Reporter: Rod Allen
>            Priority: Minor
>
> when following instructions from 
> [https://activemq.apache.org/components/classic/documentation/unix-shell-script]
>  to create an init.d or systemd script, the function in the main activemq 
> will create the data directory as the root user even if user is specified in 
> the env/setenv and copied to /etc/default/activemq. This can be seen on any 
> RHEL 8 like Linux such as Rocky Linux 8. Follow the steps in the linked 
> article, delete the $ACTIVEMQ_DATA directory and the service script will 
> create the directory as root but cannot be written to as the non-root user so 
> the service cannot be stopped. Workaround of course is to just manually 
> create the data directory.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to