Create home directory for nagios user

I'm setting up Nagios and want to configure some check_by_ssh commands.
To allow password less login I need to create a public/private key for the nagios user.
The nagios user was created by the nagios4 port without a home directory.
Code:
#  getent passwd nagios
nagios:*:181:181:Nagios pseudo-user:/var/spool/nagios:/usr/sbin/nologin
How can I create a home directory for the nagios user?
 
pw usermod <user> -d <homedir>

For zabbix user I usually use a subdirectory in the config directory (/usr/local/etc/zabbix/). This way backing up the config also includes all local scripts in that directory. Should work the same way with nagios, but its completely up to your preferences - if you want all home directories under /usr/home, just create one there...
 
pw <user> -d <homedir>

For zabbix user I usually use a subdirectory in the config directory (/usr/local/etc/zabbix/). This way backing up the config also includes all local scripts in that directory. Should work the same way with nagios, but its completely up to your preferences - if you want all home directories under /usr/home, just create one there...
Sounds like a good idea. I used the following command.
Code:
pw moduser nagios -d /usr/local/etc/nagios
 
Note that the nagios user has /usr/sbin/nologin set as its shell, which means you can't login with that account. So you may also want to set the shell to /bin/sh. Although you would only need to do this if you want to login from a remote machine to this one.
 
Back
Top