Using NFS on QNAP TS-419P - manage uid and gid
NFS is an easy way of sharing disks on a network, but it requires You to manage user and group ID's across all participating devices. Here I demonstrates how I cleaned up the users uid and gid after I actually put the QNAP TS-419P into production.
Using ssh to access the QNAP TS-419P gives (in my current configuration) access to BusyBox v1.01 (2010.02.12-04:53+0000) multi-call binary, which is a rather rich environment to work in, it feels like home if You are used to som sort of *nix or BSD environment.
First of all we need to investigate how users and groups are implemented on this particular box. Inspection of the file system tells us that the usual passwd, shadow and group files are used (of cause):
[~] # ls -l /etc/passwd
lrwxrwxrwx 1 admin administ 13 Feb 12 08:31 /etc/passwd -> config/passwd
[~] # ls -l /etc/shadow
lrwxrwxrwx 1 admin administ 13 Feb 12 08:31 /etc/shadow -> config/shadow
[~] # ls -ld /etc/config
lrwxrwxrwx 1 admin administ 21 Feb 26 09:53 /etc/config -> /mnt/HDA_ROOT/.config/
but not gshadow:
[~] # find / -name gshadow
[~] #
which I personally find a little odd. One reason might be that groups are not used very much, out of the box I find administrators, known users and every body else:
[~] # cat /etc/group
administrators:x:0:admin
everyone:x:100:admin
guest:x:65534:guest
Users are following a simple form:
[~] # cat /etc/passwd
admin:x:0:0:administrators:/root:/bin/sh
guest:x:65534:65534:guest:/tmp:/bin/sh
peterdv:x:502:100:Linux User,,,:/:/bin/sh
httpdusr:x:99:100:Apache httpd user:/tmp:/bin/sh
where uid's start off at 500, all registred users have / as the home directory and sh as their shell.
User management is best done using adduser. To create a new user peterdv with uid=1000 I first delete the existing user peterdv and then creates a new one, having the desired uid:
[~] # deluser peterdv
[~] # adduser -h / -g "Linux User" -s /bin/sh -u 1000 -G everyone -p verysecret -H peterdv
and then I change the password, of cause.
Change owner on existing files:
[~] # cd /share/MD0_DATA/
[/share/MD0_DATA] # chown -R peterdv:everyone peterdv
Questions ?
- peterdv's blog
- Login or register to post comments
- 263 reads
Printer-friendly version- PDF version
