5

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:

  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 chown -R --from=500:500 1000:1000 /path/* on all files once the config files are changed?
  4. How can I make sure the NAS has no problem with this change?
1

3 Answers 3

5

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.

1
  • 1
    This worked for me too. Instead of manually chowning the files, I installed the findutils ipkg and rand something like findutils-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.
    – m01
    Mar 16, 2013 at 20:26
0

I've just run into this thread by searching QNAP access rights to files and folders. You may also do the same thing by entering this into NAS shell:

chown -R mainuser:everyone ./*

I believe UID and GID is only local system specific, but I might be wrong.

:-)

2
  • Are you sure it's mainuser? Normally there's really only the admin on a QNAP NAS; at least on mine it is
    – slhck
    Jan 11, 2013 at 19:58
  • If 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
    Mar 16, 2013 at 14:16
0

I did it an easy way ADD GROUP Frist THEN ADD USER WITH UID and Group ID
The Group I wanted is FOCUS with GID 1961
The User I needed is FOCUS with UID 1961
(both users are on a Linux workstation tied to a software im using)
QTS Version firmware 4.5.2 1954
ssh as admin
.
[~] # addgroup -g 1961 FOCUS
[~] # adduser -u 1961 -G FOCUS FOCUS
[~] # Changing password for FOCUS
[~] # New password:
[~] # Retype password:
[~] # Password for FOCUS changed by admin
[~] # cat /etc/group
administrators:x:0:admin
everyone:x:100:admin,varian,cms
guest:x:65534:guest
FOCUS:x:1961:FOCUS
[~] # cat /etc/group
administrators:x:0:admin
everyone:x:100:admin,varian,cms
guest:x:65534:guest
FOCUS:x:1961:FOCUS

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .