How to add a new group and user to that group in Photon OS

4.7k Views Asked by At

Creating a Docker image from vmware/photon:2.0 I want to run the application inside that container as a user different than root. So, trying to create a new group and add user to it by following command:

groupadd -r new-group && useradd -r -g new-group new-user

It throws:

bash: groupadd: command not found

How can I achieve this?

2

There are 2 best solutions below

1
On

this is not necessary with Photon:3.0. all the prerequisite tools are ready. That could be because I installed a dep package or was just there.

1
On

You can install "shadow" package to be able to add groups/users.

tdnf -y install shadow