check_by_ssh Username and Password

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
nagios365
Posts: 4
Joined: Thu Oct 16, 2014 11:56 am

check_by_ssh Username and Password

Post by nagios365 »

Hi,


I need to use a ssh key with a password for my agent connections to my servers.

1. Where can I set a password for my nagios ssh user?
2. How can I change the default user names used for the nagios checks?


Thanks all!!
N
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_by_ssh Username and Password

Post by tmcdonald »

1.) Are you asking how to set a Linux password for a user? Or how to define the password to use with check_by_ssh? Setting a password for a user is done with the "passwd <username>" command, and you should be able to define the password in the form of "user:pass@address"

2.) You would need to configure and compile nagios with the appropriate flags as explained in this nagios installation guide:
Run the configure script to initialize variables and create a Makefile as follows...(the last two options: --with-command-xxx are optional, but needed if you want to issue external commands)

./configure --prefix=prefix --with-cgiurl=cgiurl --with-htmurl=htmurl --with-nagios-user=someuser --with-nagios-group=somegroup --with-command-group=cmdgroup
  • Replace prefix with the installation directory that you created in the step above (default is /usr/local/nagios)
  • Replace cgiurl with the actual url you will be using to access the CGIs (default is /nagios/cgi-bin). Do NOT append a slash at the end of the url.
  • Replace htmurl with the actual url you will be using to access the HTML for the main interface and documentation (default is /nagios/)
  • Replace someuser with the name of a user on your system that will be used for setting permissions on the installed files (default is nagios)
  • Replace somegroup with the name of a group on your system that will be used for setting permissions on the installed files (default is nagios)
  • Replace cmdgroup with the name of the group running the web server (default is nagios, in the example above it was nagcmd). This will allow group members (i.e. your web server) to be able to submit external commands to Nagios.
Former Nagios employee
nagios365
Posts: 4
Joined: Thu Oct 16, 2014 11:56 am

Re: check_by_ssh Username and Password

Post by nagios365 »

1.) Are you asking how to set a Linux password for a user? Or how to define the password to use with check_by_ssh?

No, I have adding the ssh user already.

Where do I define the passwd command, in the command.cfg?

For example I'm trying to run the check_disk command remotely.
How would I define this command for example for use for a ssh password.

Thanks again!

N
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_by_ssh Username and Password

Post by abrist »

check_by_ssh requires keys.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
nagios365
Posts: 4
Joined: Thu Oct 16, 2014 11:56 am

Re: check_by_ssh Username and Password

Post by nagios365 »

Hi,

I'm trying to use a ssh key with a password.
How do I set a password for use with a ssh key when using check_by_ssh?

Thanks
N
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_by_ssh Username and Password

Post by abrist »

You really cannot. You may be able to use an expect script, but usually check_by_ssh is only used with passwordless keys through ssh.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked