I've used yum install nagios on an Amazon Linux instance, and it created a nagios user with shell /sbin/nologin and homedir /var/spool/nagios. This is the behaviour on EC2.I want to use check_by_ssh running locally as user nagios to execute a command on the remote host as some user, without typing in a password. So using ssh-keygen seems logical, but how do I generate a public key for user nagios if that user doesn't have a shell?Is the answer to change the default shell (e.g. to bash) and perhaps the homedir of local user nagios so I can generate the key, or is there another way?Question: Is it bad practice to allow the nagios user to login?Question: Is it bad practice to change the homedir, e.g. to /home/nagios?Question: What is the recommended way of doing this?
How to enable nagios user created by yum to use check_by_ssh
ssh;monitoring;yum;remote;key authentication
Run su -c 'ssh-keygen -N ' nagios to generate the key pair, or alternatively generate the key pair as another user then copy it in place into ~nagios/.ssh. Then run su -c 'ssh-copy-id someuser@remote-host' nagios to install the public key on the remote machine.You can change the nagios user's home directory if you like, but I don't see the point.There's no need to change the nagios user's shell for what you require here.