User / group gone after reboot
I have a custom package that creates a system user and group in the 'mypackage_custom_php_install_command':
exec("/usr/sbin/pw groupadd mygroup");
exec("/usr/sbin/pw useradd myuser -c "My user" -g mygroup -d /nonexistent -s /usr/sbin/nologin");
This works, but the user and group are gone after a reboot. It worked fine on PFSense 2.0.1, but I just upgraded to the latest version 2.2.4 .
Does someone know what's changed related to the user / group creation on PFSense (between version 2.0.1 and 2.2.4)?
i would think that it would be better to write to the config, using already created functions.
Thanks for your reply.
I don't want to use the user manager functions as I'm creating a service user/group (users should not see/edit this through the web interface.) But your anwser helped me finding out what's causing the issue. I came across this function: https://github.com/pfsense/pfsense/blob/master/src/etc/inc/auth.inc#L348 . The function 'local_sync_accounts' removes my user and group after a reboot. I solved it by changing my uid/gid to a value below 2000 .
This is used in lots of packages without any problem. Yeah, keep those package accounts outside the reserved range.