Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Assume you have created a daemon (custom written) and want to create new uid/gid for this program.

Are there any standard practices?

e.g.

  1. Should the uid and gid be the same?
  2. Should the id start from 1000?

or any?

The reason I ask is currently I am using dynamically allocated, but when I have more than one machine, seems it is a good choice to use a fixed numbers?

Update: I am using Ubuntu

share|improve this question

2 Answers 2

up vote 1 down vote accepted
  • UIDs below 100 are typically reserved for system accounts and services.
  • UID between 100 and 1000 are typically reserved for applications such as Oracle, Apache, etc.
  • Typically user accounts start at 1000 or even higher. Given the number of UIDs available on most Unix systems (65,535 if not more than that), the likelihood of running out of UIDs is almost non-existent. On 64 bit system UID are stored in at least 32 bit fields and that means that maximum value is much higher.

Some distributions like RHEL recommend to set user private group (upg), which should have the same gid as the uid of the user.

There are some good guides here:
http://www.softpanorama.org/Access_control/Groups/index.shtml
http://www.softpanorama.org/Access_control/Groups/primary_group.shtml

share|improve this answer

Standard practices exist for each Linux distribution. For example, in Debian, the package for your daemon would take care of creating a "dynamically allocated" system user and group. Each will usually get an ID between 100 and 999 (see the policy manual, section 9.2.2, as a reference).

Of course, it could be considered a good practice to do so even if you're not packaging your daemon, but you are installing it on a single machine; as they are dynamically allocated, this won't interfere with other software.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.