Q:

How to move a user into a group by user_id

I don't know username but i know user_id, so How can i move that user into a group ?
Example, i know a user with user_id = 5000, and i want to move that user into group abc.
I'm using Ubuntu 14.04 LTS Desktop
Thanks in advance.

A:

As root, you can find the username with:
getent passwd 5000

It will return something like this:
username:x:5000:5000:...

The first field is the username. To add to the abc group, do this:
adduser username abc

