# Daemon users and login classes



## Roger Leigh (Sep 29, 2018)

Hi folks,

Many daemons create specific users for providing their services.  Looking at /etc/rc.subr and specific scripts such as /usr/local/etc/rc.d/gitlab_runner I see that `su -m $user` is used to switch to the user.  It appears that the use of `-m` will prevent any use of login classes and hence prevent the environment being configurable for that user?

My immediate question is whether it's possible to make the gitlab-runner user a login class with a UTF-8 locale and charset?  And more generally, for other daemon users.

(It's possible to set specific environment variables in the gitlab runner config.toml configuration file, so I have an immediate workaround for this case, but it made me curious if there was a proper way to do this with the facilities provided by the system.)


Thanks,
Roger


----------



## ShelLuser (Sep 29, 2018)

Look into login.conf(5), see also /etc/login.conf. That should give you all the options you need.


----------



## Roger Leigh (Sep 29, 2018)

The question wasn't about the login.conf format, it was rather about the configuration not being applied to daemon users when daemons are started.  I've already created a login class with suitable configuration in /etc/login.conf and also tried the same in the daemon user home directory .login_conf, but neither have any effect that I can see due to the use of `su -m`.


----------

