Why user becomes nobody?

9,328

Another possible explanation is that you run this stuff on a filesystem which is fixed to one user.

Cases for this could be ntfs or vfat.

A nfs mount with root_squash (the default) might be another reason.

Share:
9,328

Related videos on Youtube

Rosser
Author by

Rosser

Updated on September 18, 2022

Comments

  • Rosser
    Rosser over 1 year

    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 mkdir x, it becomes like:

    nobody test x

    Why user becomes nobody? How do I fix it ?

    • 11684
      11684 about 11 years
      Perhaps better at Ask Ubuntu?
    • Denys Séguret
      Denys Séguret about 11 years
      or superuser if it's not ubuntu. [note to admin : those 2 comments predate the migration and could be deleted]
    • Huygens
      Huygens about 11 years
      Could you provide the output of grep 532 /etc/passwd?
    • Rosser
      Rosser about 11 years
      test01:x:532:528::/data/test01:/bin/bash
    • Huygens
      Huygens about 11 years
      If you do ls -ldn x do you get 532 528 x for your directory ownership? And what about grep nobody /etc/passwd?
    • Rosser
      Rosser about 11 years
      yeah,the file owner uid is 99 not 532 , but I use chown test01:test x , it would be nobody again , so I don't know how to fix it.
    • Rosser
      Rosser about 11 years
      nobody:x:99:99:Nobody:/:/sbin/nologin
    • Huygens
      Huygens about 11 years
      What are the complete permissions of the parent directory of x?
    • Rosser
      Rosser about 11 years
      drwxr-xr-x. 2 nobody test 6 Mar 13 17:04 x
    • Rosser
      Rosser about 11 years
      by the way , my server is using nfs , but I add user at all server by same uid everytime.
    • Huygens
      Huygens about 11 years
      Try doing: touch /tmp/test01; ls -l /tmp/test01 is the output is correct then see @glglgl answer, it is more than probably your NFS configuration on this box that should be investigated.
    • Rosser
      Rosser about 11 years
      My nfs server is OK , it doesn't have nobody problem,But others nfs client has. What can I do?
    • Huygens
      Huygens about 11 years
      @Rosser OK, I provided you with an alternative explanation + solution in my existing answer.
  • Rosser
    Rosser about 11 years
    my nobody uid is 99 : nobody:x:99:99:Nobody:/:/sbin/nologin
  • Rosser
    Rosser about 11 years
    Thank for your explanation + solution , but the /etc/passwd in my NFS server is the same form NFS client , and my NFS server set is like : (rw,no_root_squash,sync), it should use the same uid not nobody...