Open romainguinot opened 3 years ago
Edit: I made a mistake. It does work on my environment.
As you can see below.
root@DS716:/tmp# ./synouidmod test
Database opened successfully
User 'TEST' has been found: username=test,
uid=1030, gid=100
No modifications applied to database
root@DS716:/tmp# ./synouidmod test 1030 100
Database opened successfully
User 'TEST' has been found: username=test,
uid=1030, gid=100
Modifying 'test' to uid=1030, gid=100
Update successfull
root@DS716:/tmp# ./synouidmod test
Database opened successfully
User 'TEST' has been found: username=test,
uid=1030, gid=100
No modifications applied to database
root@DS716:/tmp#
I also could not get it working on a DS716+ with the latest DSM 6.2.4-25556.
Prepare Build Server
docker create -it --name synobuild ubuntu
docker start synobuild
docker exec -it synobuild bash
Prepare Build Environment https://help.synology.com/developer-guide/create_package/prepare_build_environment.html
Build the binary
root@e5872421510b:/toolkit# chroot build_env/ds.braswell-6.2/
sh-4.3# cd /root/synouidmod/
sh-4.3# cat env.sh
PLATFORM=x86_64-pc-linux-gnu
sh-4.3# . ./build.sh
sh-4.3# ls -l synouidmod
-rwxr-xr-x 1 root root 9960 May 9 20:40 synouidmod
sh-4.3# exit
exit
root@e5872421510b:/toolkit#
Run on the DS716+
root@DS716:/tmp# ./synouidmod test 1030
Segmentation fault (core dumped)
root@DS716:/tmp#
I am on DS920+ so maybe this is where there is a difference. The original issue was that i wanted to edit the rsync permission for my user which is no longer visible in the UI. But i have found a workaround by installing rsync through opkg and supplying that one on the client side by using "--rsync-path="/opt/bin/rsync".
Therefore i don't need to modify my user for this for now.
I'd be interested though if anyone else has the issue
The only thing i can tell is that SYNOUserDbUpdate returns -1 but apart from that i don't know why or where i could find some additional diagnostics to see what is failing. The same command used to work fine before so i'm not sure what changed apart from the DSM upgrade.
Not sure. Did you rebuild synouidmod with the latest 6.2 toolchain for your platform?
Yes i just earlier today following your comment set up a clean container to set up a new clean build environment for the DS920+ (geminilake). The tool builds fine but when executing it fails with the error message "update failed".
root@nas:[/volume1/media/software/synology/synobuild/synouidmod]# ./synouidmod romain 1026 100 Database opened successfully User 'ROMAIN' has been found: username=romain, uid=500, gid=100 Modifying 'romain' to uid=1026, gid=100 Update failed
1026 is the original UID that was assigned to it. If i try a random other unassigned UID like 1136, same error. This worked fine previously when i originally set up the NAS on 6.2.3.
This is how i set up the build env in a clean fedora container on the NAS:
root@synobuild-f34:[/opt/toolkit/pkgscripts-ng]# ./EnvDeploy -v 6.2 -p geminilake
I thought they had made some changes to the DB or the SDK on which synouidmod relies but it's strange since it's working in your case ...
Some additional data. I have created a fresh 'test' user to see if there was something specific with my user. I can modify test from its assigned UID of 1034 to 600 for example, but cannot modify it back to 1034.
Does it work for you in that case ? Looks like you can no longer modify back to above 1000, but you can modify from above 1000 to below.
Same here. I deleted the user from DSM afterwards but it is now still in /etc/password and can no longer recreate the test user (user exists). Assigning a uid lower than 1000 is not a good idea so it seems...
I initially searched this tool so i didn't have to change the IDs on other machines for the NFS mappings.
If there is a way to make it work again, i might take the time to change it back and change the ID on other machines too so that there isn't any problems long term if i need to do something in the UI.
You need a uid lower than 1000? I don't think that is a good idea. At least on Synology so it seems.
BTW
I did a reboot of the server and this seems to have flushed the test user from the system. I can now create and delete the test user again.
@technorabilia Sorry for the delay missed the notification and completely forgot about it. Yeah i wanted to align my DSM main user ID with the user ID i have on other machines.
The tool still returns "update failed" but i found a much simpler process that does not involve third party tools, documented here : https://github.com/ahuacate/nas-oem-setup#36-edit-synology-nas-guid-and-uid
It turns out you can edit /etc/passwd with the desired UID and just run : synouser --rebuild all
As i understand it, this rebuilds the /var/run DB from sources such as /etc/passwd. And synouser is a synology maintained tool so it seems there is no need to modify the DB directly, you can just ask synouser to rebuild it from the files you've modified.
I have tried and at least for what i needed, it worked to temporarily pop the UID for my user to above 1000 to make it visible again in the UI, make the modification, and then pop the UID back using the above method.
It is possible also that synouser allows to modify user profiles without this limitation in the UI showing only users less than 1000 but i haven't tried for now.
The tool still returns "update failed" but i found a much simpler process that does not involve third party tools, documented here : https://github.com/ahuacate/nas-oem-setup#36-edit-synology-nas-guid-and-uid
It turns out you can edit /etc/passwd with the desired UID and just run : synouser --rebuild all
@romainguinot Thank you for sharing this. That links not only has good info on editing UID/GID on Synology, but also on other homelab things like (Proxmox and LXC containers) that are very hard to find.
@romainguinot Thank you for sharing this. Unfortunately that approach does not appear to work on DSM 7.01
Hi @sunnyone ,
I needed to change a UID temporarily after updating to 6.2.4 to be able to change something in the UI, but the synouidmod tool no longer seems to work in 6.2.4.
It worked fine back in december on DSM 6.2.3.
I rebuilt the tool on 6.2.4 thinking it might have to be rebuilt on top of the updated version of the dependencies, but didn't work as well. I'm not familiar with the synology SDK unfortunately. Do you know what the issue could be ?
Thanks, Romain.