Cross Distro way of creating a service user and group?
0
votes
1
answer
134
views
On Debian/Ubuntu systems I can use the following line to create a user and group named "dv" just for usage on a daemon service (systemd). No SSH login, no password, no home directory etc:
adduser --system --no-create-home --group dv
I realized that this does not work on Suse and RedHat/CentOS distributions (and many more). As this should be a helping bash script for installation, I need the above in a cross distro way. I found that **useradd** command is available on all these distros. But how to get the same result on all of them?
Is there a generic way of calling **useradd** to gain the same as with the above **adduser** command? Or do I need to have some if/then/else constructs to support them? Maybe there is already some working example somewhere?
Asked by Kukulkan
(1 rep)
Apr 6, 2021, 07:52 AM
Last activity: Apr 6, 2021, 12:01 PM
Last activity: Apr 6, 2021, 12:01 PM