How to change user ID on a QNAP NAS?
I did it! (and it seems to work)
So after I had no reply at all (on all sites I've posted this question) I went ahead and did what I planned.
I've logged in my NAS via ssh as admin.
Next step was to modify the follwing two files so that all users created by me have a UID and GID starting with 1000
[~] # cat /etc/passwd
admin:x:0:0:administrators:/share/homes/admin:/bin/sh
guest:x:65534:65534:guest:/share/homes/guest:/bin/sh
httpdusr:x:99:100:Apache httpd user:/tmp:/bin/sh
mainuser:x:500:100:Linux User,,,:/share/homes/mainuser:/bin/sh
test-consumer1:x:503:100:Linux User,,,:/share/homes/test-consumer1:/bin/sh
[~] # cat /etc/group
administrators:x:0:admin
everyone:x:100:admin
chagned into
[~] # cat /etc/passwd
admin:x:0:0:administrators:/share/homes/admin:/bin/sh
guest:x:65534:65534:guest:/share/homes/guest:/bin/sh
httpdusr:x:99:100:Apache httpd user:/tmp:/bin/sh
mainuser:x:1000:1000:Linux User,,,:/share/homes/mainuser:/bin/sh
test-consumer1:x:1003:1000:Linux User,,,:/share/homes/test-consumer1:/bin/sh
[~] # cat /etc/group
administrators:x:0:admin
everyone:x:1000:admin
next step was to chown and chgrp all files on the NAS. As the find that was available would not perform the exec command I did go through the dirs myself
lrwxrwxrwx 1 admin administ 18 May 19 14:16 Qdownload -> HDA_DATA/Qdownload/
lrwxrwxrwx 1 admin administ 20 May 19 14:16 Qmultimedia -> HDA_DATA/Qmultimedia/
lrwxrwxrwx 1 admin administ 20 May 19 14:16 Qrecordings -> HDA_DATA/Qrecordings/
lrwxrwxrwx 1 admin administ 13 May 19 14:16 Qusb -> HDA_DATA/Qusb/
lrwxrwxrwx 1 admin administ 13 May 19 14:16 Qweb -> HDA_DATA/Qweb/
lrwxrwxrwx 1 admin administ 10 May 19 14:16 b -> HDA_DATA/b/
lrwxrwxrwx 1 admin administ 15 May 19 14:16 backup -> HDA_DATA/backup/
lrwxrwxrwx 1 admin administ 13 May 19 14:16 home -> HDA_DATA/home/
lrwxrwxrwx 1 admin administ 10 May 19 14:16 m -> HDA_DATA/m/
lrwxrwxrwx 1 admin administ 10 May 19 14:16 v -> HDA_DATA/v/
[/share/HDA_DATA/] # chown -R 1000:1000 ./*
I could fix all files and folder at once as there was only one main user that had uploaded files to the NAS.
Next I did restart my NAS and checked logging in as the users that I just changed.
I know this might not me the most elegant, fastest or right way of doing this but it worked for me and I hope this helps someone else.
Check here as well.
Related videos on Youtube
seb
Computer, Ubuntu and Android power user who likes to understand but can't code (yet).
Updated on September 18, 2022Comments
-
seb almost 2 years
I've got a QNAP TS-110 which I access via NFS from my Ubuntu system.
I guess that NFS on a typical home network does not use any user authentication. I've read in various places and I found that it is important that the user on the Linux machine and the NAS have same UID and/or GID.
- Now my main user on Ubuntu has
uid=1000(me) gid=1000(me)
. - On the NAS the main user has
uid=500 gid=100
I figure that this is the reason that I repeatedly run into access problems. (Is that so?)
My plan was to SSH into the NAS and use
usermod -u <newuid> -g<newgid> <username>
The problem is on the NAS there is no
usermod
installed.On it.toolbox.com I've read that I could simply edit
/etc/passwd
and/etc/group
with the wanted UID and GID.In the Fedora forum is lots of discussion on how to fix the files afterwards.
My questions now are:
- Can I simply edit
/etc/passwd
and group? - How can I check that no user I want to change the UID is not logged in?
- Is it correct to use
chown -R --from=500:500 1000:1000 /path/*
on all files once the config files are changed? - How can I make sure the NAS has no problem with this change?
-
seb about 12 yearsstill looking for guidance... forum.qnap.com/viewtopic.php?f=35&t=60119
- Now my main user on Ubuntu has
-
slhck over 11 yearsAre you sure it's
mainuser
? Normally there's really only theadmin
on a QNAP NAS; at least on mine it is -
m01 over 11 yearsIf you setup multiple users on your QNAP system they should exist as linux users. By default you just can't ssh/telnet into the box using accounts other than admin.
-
m01 over 11 yearsThis worked for me too. Instead of manually
chown
ing the files, I installed thefindutils
ipkg and rand something likefindutils-find / -uid 500 -exec chmod 1000 {} \;
. That did try and unsuccessfully change some files under/proc
, but other than that it seemed to work fine.