#!/usr/bin/env bash users=$(for s in /home/*; do echo "${s##*/}"; done) subuid_start=100000 incr=65536 for user in ${users[@]}; do uid=$(id -u "$user") echo "$user:$subuid_start:$incr" >> /etc/subuid echo "$user:$subuid_start:$incr" >> /etc/subgid subuid_start=$((subuid_start + 100000)) done