Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change PUID and PGID ? #12

Open
HrRobert opened this issue Dec 1, 2020 · 11 comments
Open

How to change PUID and PGID ? #12

HrRobert opened this issue Dec 1, 2020 · 11 comments

Comments

@HrRobert
Copy link

HrRobert commented Dec 1, 2020

Hi,

how do i pass the environment variables to change the UID and GID from 12345 to 1000 ?

There are two environment varialbes for the base image which should allow to change the UID and GID in /etc/passwd and /etc/group... However, i am passing both variable for user insync and group insync but it does not change the UID or GID in the image.

Would be great if i can get some help. Other then this issue the sync seems to work fine.

Here is my docker-compose configuration :

insync-app:
image: tiredofit/insync
container_name: insync-app
networks:
- vlan99
environment:
- ZABBIX_HOSTNAME=insync-app
- INSYNC1_USERNAME=xxxx
- INSYNC1_AUTH_CODE=xxxx
- INSYNC_DOWNLOAD=ms-office
- DEBUG_PERMISSIONS=TRUE
- USER_INSYNC=1000
- GROUP_INSYNC=1000
- TIMEZONE=${TZ}

volumes:
  - ${DOCKERDIR}/insync:/data
restart: always

thx!

@tiredofit
Copy link
Owner

Try ENABLE_PERMISSIONS=TRUE - looks like for some reason that's disappeared out of the README. I will add it back in.

@HrRobert
Copy link
Author

HrRobert commented Dec 1, 2020

I am added "ENABLE_PERMISSIONS=TRUE" and it works fine for the user. However the group insync still has ID 12345.

Those are the corresponsing entries in the container :

/etc/passwd -> insync:x:1000:12345:Insync,,,:/home/insync:/bin/bash
/etc/group -> insync:x:12345:"${varenvuser2add[$i]}"

btw, is there also a way to set default permissions to e.g. 770 ?

thank you!

@tiredofit
Copy link
Owner

I'll have to look into the code here as to why the group isn't working - there's definitely a problem there it sending that environment variable over. I won't be able to look into this for a couple of days, but I can implement a custom script functionality that will let you execute something before insync starts mounted from an external volume. I can do that one sooner than the permissions debugging.

@tiredofit
Copy link
Owner

I just tagged tiredofit/insync:2.3.1 which allows you to mount a volume into /assets/custom-scripts/ that will execute any .sh scripts in that folder.

For example you could have two scripts:

01-rename_permissions.sh and do a dirty permission change on the /etc/passwd and group files while I figure out why that function has stopped working on debian.

02-set_folder_permissions.sh chmod 770 and any other file operations you wanted to make on your /data folder.

Hope this helps in the short term.

@HrRobert
Copy link
Author

HrRobert commented Dec 1, 2020

No worries, take you time i am not in rush. For the moment it's total fine, for the long run it would be nice to tighten the access to my google drive data.

Thank you!

@HrRobert
Copy link
Author

HrRobert commented Dec 1, 2020

ok just see your last message.. i will try the work around. Thank you so much for your effort!

@tiredofit
Copy link
Owner

No problem! Just make sure you set the scripts to be executable.

@ptruman
Copy link

ptruman commented Jan 4, 2021

Same issue here - updated recently, and copied in some files from my PC share, and insync created the GDrive folders, but didn't copy the files.

Restarted it, the files copied, but then I couldn't copy them back as they were owned 12345:12345
Added the ENABLE_PERMISSIONS=TRUE and the UID change is working, just the GID stuck per the above.

I'm still on insync 1, as although I'd like to remove the security warning in Google, I'm not moving to a sub model with insync :)

@tiredofit
Copy link
Owner

Can you try pulling tiredofit/insync:groupfix and see if this solves your group issues?

@ptruman
Copy link

ptruman commented Jan 4, 2021

That appears to be working - I've got my intended UID and GID showing now after a pull/restart :)

[NOTICE] ** [permissions] Enabling permissions features,
[NOTICE] ** [permissions] uid of user insync has been changed to 1000.,
[NOTICE] ** [permissions] Total 1 UIDs modified,
[NOTICE] ** [permissions] gid of group insync has been changed to 100.,
[NOTICE] ** [permissions] total 1 GIDs modified

@tiredofit
Copy link
Owner

OK perfect. The problem resides in the upstream debian base image i wrote. What I'm going to do is fix it inside of that image and let it trickle across to all other dependent Debian images. Usually takes 2-3 days for Docker Hub to perform a build of all images. After that you can head back to :latest :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants