I have a problem about linux user, I use a command to add user like:
useradd -u 532 -d /data/test01 -g test test01
but when I login as
test01 and run
it becomes like:
nobody test x
Why user becomes
How do I fix it ?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
A possible explanation is that you already had a user called nobody with the UID (User ID) 532. The result is you have created a "user alias".
You either can try to specify another UID for your user (or let the system pick-up one). Or you can leave it like that. The only security risk is that if a service or other user can access
nobody's data then it will be able to access your data.
For users to have the feeling they are accessing their own files, the UID on the NFS server should match the UID on the NFS clients. Although, you want to avoid that for
root at least.
By default, NFS exportfs will choose UID/GID of 65534 which corresponds to your user
nobody's UID. You need to instruct the NFS server not to map all UID to 65534 or if this is the wanted behaviour, you need to specify the mapped default UID.
For the first case, remove the
all_squash and replace it by
root_squash, but bare in mind that any non root user with a similar UID between the NFS server and any clients will be a match, so they own the files"
For the second case, keep the
all_squash but add
anonuid=532 (you can use also
anongid for the GID (or Group ID)).
/ pc001(rw,root_squash) /home/joe pc002(rw,all_squash,anonuid=532,anongid=100)
Note: the changes should be done in the file
/etc/exports on the NFS server.