Change uid and gid of virtualdomain


I am starting with virtualmin, so I would like to ask if there is a way to change the uid and gid of the users of a domain easier than the explained below.

I think that this can be perform following the next actions:

1.- Change the uid an gid on /etc/passwd and /etc/groups

2.- Change the uid and gid on /etc/virtual-server/domains/[0-9]+ (filename associated with the domain)

3.- Change the uid and gid on /etc/httpd/conf/httpd.conf for suexec

4.- Change owner and group to user files:

        find /home/username -uid old_uid -exec chown new_uid {} \;

        find /home/username -gid old_gid -exec chgrp new_gid {} \;

Thanks in advance

I don’t think there is an automated way to do that – the steps you listed to do it manually sound correct. Also take note that there may be multiple users with the UID in question in /etc/passwd, i.e. if you have (sub-)servers with FTP Access users.

May I ask why you’d need to change the UID and GID? Maybe there’s an easier way to accomplish your goal.

I started creating some domains that are being used and I would like to change it uid and gid.

Because I would like to have all virtualmien user above 5000 uid and did.

Well, if you go into Webmin -> System -> Users and Groups -> Module Config -> New User Options, you can change “Lowest UID for new users”.

However, I believe that’s for all users, not just Virtualmin users.

So when creating users outside of Virtualmin, you’d need another way to specify the UID/GID for those users if you don’t want it to start at 5000+.


I changed this options on my test machine but I forgot to change it on my production machine and I started creating domains. After that, I notice that the uids are wrong so I have to change it.

That is to say, the new domains are created right but the domains created before changing the lowest uid and gid not, for this reason I have to change this users.

I reserve low uids to admin and other special users.