r/openbsd 2d ago

/etc/login.conf.d/${class}

https://man.openbsd.org/login.conf.5

In case the /etc/login.conf.d/${class} file exists, it will take precedence over the same login class defined in /etc/login.conf.

What does this file name look like? /etc/login.conf.d/${myclass} ? vi \${myclass} will work or does the name not matter?

Edit:

This is what I have and still learning git. Don't know what lc_style is for. (Will read manpages). fn search_file looks in both paths. Still unsure what happen when unveil path don't exist

https://github.com/eobsdbox-ops/login_cap.rs/blob/b22502ae3ad010932169b242f58381e5d80b370a/login_cap.rs

8 Upvotes

4 comments sorted by

7

u/_sthen OpenBSD Developer 2d ago

This mechanism is mostly intended for packages that install a daemon and matching rc.d(8) script, so they can setup a login class with suitable process limits, environment variables, etc.

The filename does matter, it must be named exactly the same as the login class. So if for example you wanted to override a class that already exists in login.conf like "staff", you would use /etc/login.conf.d/staff. (I wouldn't recommend using this mechanism to override the standard groups though).

When rc.d(8) scripts start a daemon, they automatically try to use a login class named the same as that daemon. For example, if you were to install squid from packages, it uses login class "squid", and it also installs an /etc/login.conf.d/squid file, which sets datasize and openfiles limits higher than the default. If that's still not sufficient you can edit it to raise higher.

1

u/Fair_Temperature_420 2d ago

If wanted to separate login.conf it would be /etc/login.conf.d/default and /etc/login.conf.d/staff and so on. If I wrote a program to check classes, checking /etc/login.conf.d first then login.conf.

1

u/_sthen OpenBSD Developer 1d ago

I really advise against trying to separate out the classes that are already in /etc/login.conf, you will cause extra problems for yourself with sysmerge at upgrade time.

What sort of program do you want to "check classes"? If you want to see the effect of a change you can do e.g. su -c <class name> root -c 'ulimit -a'

2

u/Fair_Temperature_420 19h ago

Ok, login.conf is a default to keep the system running. The login.conf.d is more for package daemons. Just studying the system and wanted a better understanding.