[opensuse] Usergroup guidline?
Hello, I wan't to create a new usergroup but don't want a collision with system groups later. Is there a guidline which GIDs I can use which will never be used by opensuse? Regards Daniel -- Daniel Spannbauer Systemadministration marco Systemanalyse und Entwicklung GmbH Tel +49 8333 9233-27 Fax -11 Rechbergstr. 4-6, D 87727 Babenhausen Mobil +49 171 4033220 http://www.marco.de/ Email ds@marco.de Geschäftsführer Martin Reuter HRB 171775 Amtsgericht München -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2019-02-01 12:03, Carlos E. R. wrote:
On 01/02/2019 10.51, Daniel Spannbauer wrote:
Hello,
I wan't to create a new usergroup but don't want a collision with system groups later.
Just use a high enough number. Above 1000, currently.
A good thing is to consult /etc/login.defs and look for GID_MIN, GID_MAX. <OT> A trip down memory lane. I dabbled with this a few years back when LSB (Linux Standard Base) was the hot thing and we were making our own router distribution. GID followed UID. The system User IDs from 0 to 99 should be statically allocated by the system, and shall not be created by applications. The system User IDs from 100 to 499 should be reserved for dynamic allocation by system administrators and post install scripts using useradd. ref. https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-gen... </OT> Cheers, -- /bengan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 01/02/2019 12.49, Bengt Gördén wrote:
On 2019-02-01 12:03, Carlos E. R. wrote:
On 01/02/2019 10.51, Daniel Spannbauer wrote:
Hello,
I wan't to create a new usergroup but don't want a collision with system groups later.
Just use a high enough number. Above 1000, currently.
A good thing is to consult /etc/login.defs and look for GID_MIN, GID_MAX.
<OT> A trip down memory lane.
I dabbled with this a few years back when LSB (Linux Standard Base) was the hot thing and we were making our own router distribution. GID followed UID.
The system User IDs from 0 to 99 should be statically allocated by the system, and shall not be created by applications.
The system User IDs from 100 to 499 should be reserved for dynamic allocation by system administrators and post install scripts using useradd.
ref. https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-gen...
</OT>
Yes, but at some point SuSE decided to go up to 1000, not 500 :-) -- Cheers / Saludos, Carlos E. R. (from 15.0 x86_64 at Telcontar)
On 02/01/2019 05:03 AM, Carlos E. R. wrote:
On 01/02/2019 10.51, Daniel Spannbauer wrote:
Hello,
I wan't to create a new usergroup but don't want a collision with system groups later.
Just use a high enough number. Above 1000, currently.
Or you can use a quick script to scan the current used GIDs in /etc/passwd and find the next available greater than 1000, you can simply dump the sorted list of GIDs with E.g. awk -F: '{if ($4 >= 1000) print $4}' /etc/passwd | sort -n If you don't have that many groups, then the awk command is all you need. If you have hundreds of GIDs starting at 1000 and it is a pain manually read through the sorted GIDs, you can automate finding the next available by looping over the results and finding the next available: declare -i ngid=1000 while read used && ((used == ngid)); do ((ngid++)) done < <(awk -F: '{if ($4 >= 1000) print $4}' /etc/passwd | sort -n) echo "next available GID: $ngid" -- David C. Rankin, J.D.,P.E.
On 02/02/2019 08.15, David C. Rankin wrote:
On 02/01/2019 05:03 AM, Carlos E. R. wrote:
On 01/02/2019 10.51, Daniel Spannbauer wrote:
Hello,
I wan't to create a new usergroup but don't want a collision with system groups later.
Just use a high enough number. Above 1000, currently.
Or you can use a quick script to scan the current used GIDs in /etc/passwd and find the next available greater than 1000, you can simply dump the sorted list of GIDs with E.g.
awk -F: '{if ($4 >= 1000) print $4}' /etc/passwd | sort -n
If you don't have that many groups, then the awk command is all you need.
If you have hundreds of GIDs starting at 1000 and it is a pain manually read through the sorted GIDs, you can automate finding the next available by looping over the results and finding the next available:
declare -i ngid=1000 while read used && ((used == ngid)); do ((ngid++)) done < <(awk -F: '{if ($4 >= 1000) print $4}' /etc/passwd | sort -n) echo "next available GID: $ngid"
cat /etc/group | cut -d ":" -f 3 | sort -g You can not simply use the largest number found, because some very high numbers are probably in use, like 65534 (nogroup). You have to examine the output. -- Cheers / Saludos, Carlos E. R. (from 15.0 x86_64 at Telcontar)
participants (4)
-
Bengt Gördén
-
Carlos E. R.
-
Daniel Spannbauer
-
David C. Rankin