Pages: [1]   Go Down
Author Topic: Arranque/stop scripts  (Read 435 times)
0 Members and 1 Guest are viewing this topic.
david
Jr. Member
**

Karma: 0
Offline Offline

Posts: 13


View Profile
« on: March 27, 2007, 12:27:47 PM »

Hola tengo una duda,

Como puedo arrancar por ejemplo el script del agente como usuario pandora? esta duda me surge ya que al hacer que este script se ejecute desde init.d lo hará como root, no funcionando de esta manera la conexion  ssh.

he probado poniendo en el script pandora_agent_daemon su - pandora, pero no me funciona.

alguna sugerencia? o ejemplo?
Muchas gracias.
« Last Edit: January 01, 1970, 01:00:00 AM by david » Logged

Manuel Arostegui
Global Moderator
Expert member
*****

Karma: 50
Offline Offline

Posts: 853



View Profile
« Reply #1 on: March 27, 2007, 02:54:34 PM »

Bueno, el agente siempre intenta conectarse como usuario pandora al server remoto.
Así que entiendo que el problema es que al lanzarlo como root, se buscan las claves en /root/.ssh/, ¿cierto? y tú quieres que sean en /home/pandora/.ssh/, ¿correcto?

Si te fijas en la linea: (de pandora_agent.sh)
    # Send packets to server and detele it
        scp -P $SERVER_PORT $PANDORA_FILES pandora@$SERVER_IP:$SERVER_PATH > /dev/null 2>  $PANDORA_LOGFILE.err

Puedes cambiarlo a mano y pasarle la opcion "-i" a scp para indicarle qué llaves quieres que use (la localización)

Un saludo
« Last Edit: January 01, 1970, 01:00:00 AM by manu » Logged

david
Jr. Member
**

Karma: 0
Offline Offline

Posts: 13


View Profile
« Reply #2 on: March 27, 2007, 03:34:28 PM »

Hola Manu,

El problema es exactamente lo que dices, lo que pasa es que no acabo de resolverlo,

ejemplo:
root@pluton:/opt/pandora_agent# scp -v pandora.log pandora@172.24.43.74:/tmp -i /home/pandora/.ssh/
Executing: cp pandora.log /home/pandora/.ssh/
Executing: program /usr/bin/ssh host 172.24.43.74, user pandora, command scp -v -d -f /tmp
OpenSSH_4.3p2 Debian-5ubuntu1, OpenSSL 0.9.8b 04 May 2006
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 172.24.43.74 [172.24.43.74] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-5ubuntu1
debug1: match: OpenSSH_4.3p2 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3p2 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
The authenticity of host '172.24.43.74 (172.24.43.74)' can't be established.
RSA key fingerprint is 4b:e5:9f:b4:f3:61:97:a6:74:3c:d5:bb:34:e6:14:d6.
Are you sure you want to continue connecting (yes/no)?


al final no me valida, si me paso a usuario pandora el ssh funciona perfectamente, sólo cuando es root, por  las claves como tu dices.

Estoy aplicando bien la opcion -i ?
« Last Edit: January 01, 1970, 01:00:00 AM by david » Logged

Manuel Arostegui
Global Moderator
Expert member
*****

Karma: 50
Offline Offline

Posts: 853



View Profile
« Reply #3 on: March 27, 2007, 03:58:53 PM »

Efectivamente, lo estás haciendo mal :-)
La sintaxis es:

scp -i /home/pandora/.ssh/nombre_de_la_llave pandora.log  pandora@172.24.43.74:/tmp

Saludos!
« Last Edit: January 01, 1970, 01:00:00 AM by manu » Logged

david
Jr. Member
**

Karma: 0
Offline Offline

Posts: 13


View Profile
« Reply #4 on: March 27, 2007, 04:00:06 PM »

OK, perdon ya se ha solucionado.

el -i va delante tal que así

scp -i /home/pandora/.ssh/id_dsa $PANDORA_FILES pandora@$SERVER_IP:$SERVER_PATH > /dev/null 2> /dev/null


Un saludo y gracias por la respuesta tan rápida!
« Last Edit: January 01, 1970, 01:00:00 AM by david » Logged

Pages: [1]   Go Up
Print
 
Jump to:  


SourceForge.net Logo  This site is monitored by Pandora FMS   ArticaST