11 Replies Latest reply on Nov 28, 2012 2:43 AM by wdfink

    Debian Linux directory access permissions?

    stickybandit

      What is the proper way to get a web application to be able to read access a directory folder like /opt/myFolder.

      I already have the java code that does it.  The question is more about permissions of JBoss etc.

       

      a) Do I need to CHOWN anything?  My installation does not have a jboss user, do I need one?

        • 1. Re: Debian Linux directory access permissions?
          wdfink

          That is nothing related to java.

          you need to have access to that directory and its content.

          The directory should have r-x permission and files r--, and it depends on the user which starts JBoss whether you need the permission for owner, group or other

          1 of 1 people found this helpful
          • 2. Re: Debian Linux directory access permissions?
            stickybandit

            The r-x and r-- are not the problem they are correct. 

            The owner of /myFolder/ is root, but the owner of the jboss installation directory folder says 501 ?

            JBOSS is started with root.

            1 of 1 people found this helpful
            • 3. Re: Debian Linux directory access permissions?
              wdfink

              501 sounds like that the user is removed, you may change to a valid one.

               

              If you start as root the files should be accessible, you can simple check it with the shell using commands like cat, tail ...

               

              Starting JBoss as root will be a security risk.

              Also it break the contract if an EE-app uses java.io, the results might not what you expect.

              • 4. Re: Debian Linux directory access permissions?
                stickybandit

                If I start JBoss as a jboss user it won't find java 7 etc.  So would I have to make the java folder CHOWNed by jboss user and also the JBoss install folder?

                • 5. Re: Debian Linux directory access permissions?
                  wdfink

                  I suppose you installed Java via OS tools, in that case it is a environment issue.

                  Could you access 'java -version' from the console?

                  If not you might set the path or change the jboss environment by editing JBOSS/bin/run.conf (or standalone.conf if U use AS7)

                  • 6. Re: Debian Linux directory access permissions?
                    stickybandit

                    I use AS7

                     

                    root@cloud:/# java -version
                    java version "1.7.0_02"
                    Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
                    Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
                    root@cloud:/#

                     

                     

                     

                     

                     

                    root@clouddev:/# su jboss
                    $ java -version
                    sh: java: not found
                    $

                    • 7. Re: Debian Linux directory access permissions?
                      wdfink

                      I suppose cloud and cloudev are different machines, right?

                      You need to check the installation at clouddev and install a propper java.

                      • 8. Re: Debian Linux directory access permissions?
                        stickybandit

                        Actually cloud and clouddev are different machines setup the same and they both have java installed the exact same way.

                        clouddev is my test maching and I created a user called jboss.  as you can see jboss still can't see java.  So back to my original question

                        what is the proper way to access a folder and to start up jboss (user?).

                        • 9. Re: Debian Linux directory access permissions?
                          wdfink

                          That JBoss can not see Java is a OS (or shell) problem.

                          You might use 'type java' to see whether the OS find it.

                          Maybe you destroy the PATH variable in your .bashrc if both machines are installed equal ?

                           

                          To run JBoss the common approach is to create a user and run the JBoss instance under user control.

                          A proper way to access a directory from an application is not available as this is not allowed from EE perspective.

                           

                          If you will do so you should set the appropriate permissions for the group or others and maybe set a symlink.

                          • 10. Re: Debian Linux directory access permissions?
                            stickybandit

                            Thanks for all the replies:

                             

                            'type java' returns the correct java path when logged in as root.

                            'type java' returns 'java: not found when using the jboss user after executing 'su jboss'.

                             

                            Your last comment of 'If you will.....'

                            that is what I am asking, what does one have to do to make the .war file able to read the folder.

                             

                            I have set the folder to group 'jboss' & owner 'jboss'

                            • 11. Re: Debian Linux directory access permissions?
                              wdfink

                              For java you should check the environment '$PATH' I suppose the path is not correct, maybe reset by the .bashrc of user jboss.

                               

                              If the user jboss is also in the group jboss you might set 'rwx' for user and group, this allow the fileaccess from OS perspective.

                              But I'm not sure ATM how you can access the files, it is against the JEE contract (but will work in most cases).

                              Problems you might have is the setting of 'current directory', it may depend on how you start JBoss. Also you will have several problems in a clustered environment.