No permission to create directory in mounted volume

App can be found here: GitHub - drewthor/wolves_reddit_bot at rest-rewrite

volume is mounted as root and app is running as user id 1000 (which doesn’t appear to even exist?). I do not have a dockerfile, but attempted to specify the user of the application via the following in fly.toml

[build.args]
    User = "nba"

Am I supposed to create a new user somehow after ssh’ing into the console? Do I need to provide a barebones Dockerfile that specifies a user? Any way to unmount the volume and have it re-mounted with the same user as my app?

Help would be greatly appreciated

Hi @drewthor. If you’re not using a Dockerfile I assume you’re using a builder/buildpack? The user will likely be set there, so it’ll be useful to see what happening there. Once that’s clear the permissions can be set a bit like this: Can't create Sqlite database in mounted volume - #6 by kurt

1 Like

@sudhir.j Thanks for the reply! Yes, when fly setup the toml file it auto selected paketo buildbacks and a builder for me. I am 100% unfamiliar with those. Is under [build] in the toml file where I need to set the user?

@sudhir.j looks like my issue is exactly the same as the link you mentioned. I was able to figure things out and a chown resolved things.

If someone is reading this with the same issue using the default go paketo builder/buildpack:
I was unable to get the list of users via the console, but by putting an os.Getuid() in my app and printing it out to stdout I was able to get the user id in my logs (in my case the user id was 1000). From there, I was able to issue the command id -un 1000 to get the user which in my case is cnb. chown -R cnb:cnb /data where my volume mountpoint is /data solved everything and now I am properly writing to the volume!

1 Like