Results 1 to 2 of 2

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

  1. #1
    Join Date
    Aug 2008
    Location
    Germany, Frankfurt
    Beans
    51
    Distro
    Ubuntu 10.04 Lucid Lynx

    Question How to change user ID on a QNAP NAS?

    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:
    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:
    /etc/passwd
    and
    Code:
    /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:
      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?


    Thanks for the help.
    Regards,
    Seb

  2. #2
    Join Date
    Aug 2008
    Location
    Germany, Frankfurt
    Beans
    51
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: 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
    Code:
    [~] # 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:
    [~] # 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:
    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.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •