programmatically editing /etc/login.conf

Thomas Cort linuxgeek at
Fri Nov 6 15:29:47 UTC 2015

I'd like to have a script be able to add/modify/remove environment
variables that are set systemwide for all users (interactive and
non-interactive logins).

Manually editing /etc/login.conf and running cap_mkdb works for setting the
environment variables, but how can I automate the editing? Are there any
tools where I can say "add FOO=bar to setenv for default"? Due to the file
format, it seems like a tough job for sed/awk. Or is there an alternative
way of setting system wide environment variables?


More information about the freebsd-questions mailing list