Finding gid and uid of user

Currently reading
Finding gid and uid of user

So - one of the things I love most about the synology is its docker support - I'm now running heaps of different docker containers.

But every time I run into the same problem - I want to run the container as particular user, but I have to specify the gid and uid.
Whcih normally ends up with me sshing into the box and doing lots of commands like id -u darren, then id -G darren etc

Is there anyway from inside the synology ui to see what the uid and gid are for particular users? or has anyone made a friendly little app that does that and I can just install?
or do I need to do it myself?
 
Last edited:
You could create a scheduled task but don't enable it. Then script want you want and have the output sent to a file in you admin account's home folder. Something like this to read the password file and print out each user and their uid and gid on separate lines.

Bash:
cat /etc/passwd | awk -F : '{print $1"\n\tu: "$3"\n\tg: "$4}' > /volume1/homes/ADMIN/user_uid_gid.txt

Run as your ADMIN user as and when you want a new list. File Station can open text files.

You could do something similar to get the full user membership of groups. Even add it to the same task.

Bash:
cat /etc/group | awk -F : '{print $1"\n\tg: "$3"\n\tu: "$4}' > /volume1/homes/ADMIN/group_gid_users.txt


Update:
It's a useful question and one I've had to resort to SSH to answer in the past.

Here is the user-defined script that I've created to create the two text files in my admin's home folder.
  • In General Settings select your admin user (not root).
  • Edit the script value of USER_HOME to use the volume used by User Home (volume1 is usual unless you have changed it).
  • Edit the script value of MY_USER to be the short name of your admin user.
Bash:
#!/bin/bash

USER_HOME="volume1"
MY_USER="MY_ADMIN_SHORT_NAME"

cat /etc/passwd | awk -F : '{print $1"\n\tu: "$3"\n\tg: "$4}' > "/${USER_HOME}/homes/${MY_USER}/user_uid_gid.txt"
cat /etc/group | awk -F : '{print $1"\n\tg: "$3"\n\tu: "$4}' > "/${USER_HOME}/homes/${MY_USER}/group_gid_users.txt"
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Old thread notice: There have been no replies in this thread for quite some time. The last reply was on .
The content in this thread may no longer be relevant. It might be better to open a new thread instead.

Similar threads

Any app - goal is quickest way to save files from iOS Camera Roll to Synology....typically 1 of 3 places...
Replies
7
Views
1,970

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Back
Top