How to change user ID on a QNAP NAS?

Discussion about using NAS on Linux and Unix OS.
Locked
seb_1204
New here
Posts: 3
Joined: Mon Jun 11, 2012 6:24 pm

How to change user ID on a QNAP NAS?

Post by seb_1204 »

Hi all,
I've got a QNAP TS-110 which I access via NFS from my Ubuntu 12.04 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

Code: Select all

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

Code: Select all

/etc/passwd
and

Code: Select all

/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:
  1. Can I simply edit /etc/passwd and group?
  2. How can I check that no user I want to change the UID is not logged in?
  3. Is it correct to use

    Code: Select all

    chown -R --from=500:500 1000:1000 /path/*
    on all files once the config files are changed?
  4. and most importantly... How can I make sure the NAS has no problem with this change?
Thanks for the help.
Regards,
Seb
seb_1204
New here
Posts: 3
Joined: Mon Jun 11, 2012 6:24 pm

Re: How to change user ID on a QNAP NAS?

Post by seb_1204 »

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

Code: Select all

[~] # 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

Code: Select all

[~] # 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

Code: Select all

l
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.

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.
funkenbus.driver
New here
Posts: 9
Joined: Sun Jun 17, 2012 3:35 pm

Re: How to change user ID on a QNAP NAS?

Post by funkenbus.driver »

After installing findutils from ipkg you can use the findutils-find that supports the -exec switch. I think its also comfortable to alias find to findutils-find.
xpliant-admin
New here
Posts: 5
Joined: Wed May 09, 2012 3:31 am

Re: How to change user ID on a QNAP NAS?

Post by xpliant-admin »

I have the same problem. I have a pre-existing Linux network running NIS with many users. I would like the UIDs of the NAS users to match the UIDs of the NIS users. Currently they are different, which means that users connecting to the NAS from Windows clients cannot edit the files they created while logged in to the Linux servers (without messing with access permissions).

It would be very helpful if the "Create A User" screen allowed the admin to manually enter the new user's UID.

I have tried editing /etc/passwd on the NAS for one user and it seems to work. The strange thing is that it works even though I did not change /etc/config/smbpasswd. smbpasswd still has the user's old UID. Since this is a production system, I'm hesitant to just blindly edit /etc/passwd.
Does anyone have any advice?

TIA
RoyIvyIII
New here
Posts: 4
Joined: Thu Apr 22, 2010 4:04 am

Re: How to change user ID on a QNAP NAS?

Post by RoyIvyIII »

On my TS-859 and TS-1679 machines, I have working "/usr/local/bin/user{add,del,mod}" executables with all of the modern flags and functions.

The "/usr/bin/local" path is not in my default PATH, which may be why you haven't stumbled upon the functions. But you could add the "/usr/local/bin" to PATH in your ".profile", and you'll have normal user creation/deletion/editing functions.
q700-boy
New here
Posts: 2
Joined: Mon Jan 02, 2012 2:17 am

Re: How to change user ID on a QNAP NAS?

Post by q700-boy »

I used this command to change "user1000" to UID 1000 on my TS-219 with firmware 4.2.2:

Code: Select all

# usermod -u 1000 user1000
and then edited the group everyone to include 1000 instead of 100.

Code: Select all

# vi /etc/group
   everyone:x:1000:admin
lmcogs
First post
Posts: 1
Joined: Fri Aug 05, 2022 2:17 am

Re: How to change user ID on a QNAP NAS?

Post by lmcogs »

Thanks seb this worked for me sharing to windows 10 to qnap ts-410. Imagine after all this time Windows still have not made this easier or for that matter qnap. I had no problem sharing to linux box.
User avatar
dolbyman
Guru
Posts: 35021
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: How to change user ID on a QNAP NAS?

Post by dolbyman »

Please do not necropost into 10(!!!) year old topics for a "Thanks"

Thread closed
Locked

Return to “Linux & Unix (NFS)”