Ubuntu: How to move a user into a group by user_id



Question:

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.


Solution:1

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  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »