apko icon indicating copy to clipboard operation
apko copied to clipboard

Unable to assign permissions to subdirectories & files

Open jasaz opened this issue 2 years ago • 2 comments

I am building a Tomcat 9 Alpine base image and the I'm not able to assign permissions to the subdirectories and files within /etc/tomcat9 and /usr/share/tomcat9 for nonroot user using the accounts & paths section below. However, when I assign a root permission by removing the accounts and paths section, it works.

contents:
     packages:
         - openjdk8-jre
         - tomcat9
accounts:
     groups:
         - groupname: nonroot
         - gid: 76543
      users:
         - username: non root
         - uid: 76543
       run-as: nonroot

paths:
       - path:  /etc/tomcat9
          type: permissions
          uid: 76543
          gid: 76543
          permissions: 0o775
          recursive: true
       - path:  /usr/share/tomcat9
          type: permissions
          uid: 76543
          gid: 76543
          permissions: 0o775
          recursive: true


environment:
     PATH:  /bin:/usr/lib/jvm/java-8-openjdk/bin:/usr/share/tomcat9/bin
     JAVA_HOME:  /usr/lib/jvm/java-8-openjdk
     CATALINA_HOME:  /usr/share/tomcat9

entrypoint:
    command: catalina.sh run

archs:
    - x86_64

jasaz avatar Apr 12 '23 05:04 jasaz

I can't rebuild this, I'm not sure where the packages come from. I assume openjdk8-jre is Alpine, but I don't know where tomcat9 comes from.

I do note the indentation is a bit off and the uid and gid lines should not begin with -.

If you can provide me with an example I can build, I'll happily take another look.

amouat avatar Apr 13 '23 13:04 amouat

Hi, both are Alpine. Tomcat9 is from the Testing branch in Alpine repo though. Apologies, there would have been some indentation issue as I couldn't copy the exact code due to firewall. I had to type it again.

jasaz avatar Apr 15 '23 14:04 jasaz