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)