makeusers-syntax.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // -*- mode:doc -*- ;
  2. // vim: set syntax=asciidoc:
  3. [[makeuser-syntax]]
  4. == Makeusers syntax documentation
  5. The syntax to create users is inspired by the makedev syntax, above, but
  6. is specific to Buildroot.
  7. The syntax for adding a user is a space-separated list of fields, one
  8. user per line; the fields are:
  9. |=================================================================
  10. |username |uid |group |gid |password |home |shell |groups |comment
  11. |=================================================================
  12. Where:
  13. - +username+ is the desired user name (aka login name) for the user.
  14. It can not be +root+, and must be unique. If set to +-+, then just a
  15. group will be created.
  16. - +uid+ is the desired UID for the user. It must be unique, and not
  17. +0+. If set to +-1+ or +-2+, then a unique UID will be computed by
  18. Buildroot, with +-1+ denoting a system UID from [100...999] and +-2+
  19. denoting a user UID from [1000...1999].
  20. - +group+ is the desired name for the user's main group. It can not
  21. be +root+. If the group does not exist, it will be created.
  22. - +gid+ is the desired GID for the user's main group. It must be unique,
  23. and not +0+. If set to +-1+ or +-2+, and the group does not already
  24. exist, then a unique GID will be computed by Buildroot, with +-1+
  25. denoting a system GID from [100...999] and +-2+ denoting a user GID
  26. from [1000...1999].
  27. - +password+ is the crypt(3)-encoded password. If prefixed with +!+,
  28. then login is disabled. If prefixed with +=+, then it is interpreted
  29. as clear-text, and will be crypt-encoded (using MD5). If prefixed with
  30. +!=+, then the password will be crypt-encoded (using MD5) and login
  31. will be disabled. If set to +*+, then login is not allowed. If set to
  32. +-+, then no password value will be set.
  33. - +home+ is the desired home directory for the user. If set to '-', no
  34. home directory will be created, and the user's home will be +/+.
  35. Explicitly setting +home+ to +/+ is not allowed.
  36. - +shell+ is the desired shell for the user. If set to +-+, then
  37. +/bin/false+ is set as the user's shell.
  38. - +groups+ is the comma-separated list of additional groups the user
  39. should be part of. If set to +-+, then the user will be a member of
  40. no additional group. Missing groups will be created with an arbitrary
  41. +gid+.
  42. - +comment+ (aka https://en.wikipedia.org/wiki/Gecos_field[GECOS]
  43. field) is an almost-free-form text.
  44. There are a few restrictions on the content of each field:
  45. * except for +comment+, all fields are mandatory.
  46. * except for +comment+, fields may not contain spaces.
  47. * no field may contain a colon (+:+).
  48. If +home+ is not +-+, then the home directory, and all files below,
  49. will belong to the user and its main group.
  50. Examples:
  51. ----
  52. foo -1 bar -1 !=blabla /home/foo /bin/sh alpha,bravo Foo user
  53. ----
  54. This will create this user:
  55. - +username+ (aka login name) is: +foo+
  56. - +uid+ is computed by Buildroot
  57. - main +group+ is: +bar+
  58. - main group +gid+ is computed by Buildroot
  59. - clear-text +password+ is: +blabla+, will be crypt(3)-encoded, and login is disabled.
  60. - +home+ is: +/home/foo+
  61. - +shell+ is: +/bin/sh+
  62. - +foo+ is also a member of +groups+: +alpha+ and +bravo+
  63. - +comment+ is: +Foo user+
  64. ----
  65. test 8000 wheel -1 = - /bin/sh - Test user
  66. ----
  67. This will create this user:
  68. - +username+ (aka login name) is: +test+
  69. - +uid+ is : +8000+
  70. - main +group+ is: +wheel+
  71. - main group +gid+ is computed by Buildroot, and will use the value defined in the rootfs skeleton
  72. - +password+ is empty (aka no password).
  73. - +home+ is +/+ but will not belong to +test+
  74. - +shell+ is: +/bin/sh+
  75. - +test+ is not a member of any additional +groups+
  76. - +comment+ is: +Test user+
  77. === Caveat with automatic UIDs and GIDs
  78. When updating buildroot or when packages are added or removed to/from
  79. the configuration, it is possible that the automatic UIDs and GIDs are
  80. changed. This can be a problem if persistent files were created with
  81. that user or group: after upgrade, they will suddenly have a different
  82. owner.
  83. Therefore, it is advisable to perpetuate the automatic IDs. This can be
  84. done by adding a users table with the generated IDs. It is only needed
  85. to do this for UIDs that actually create persistent files, e.g. database.