[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [semi-OT]Manejar SSH con cualquier usuario



Hagamos las pruebas:

El día 21 de febrero de 2013 13:27, Camaleón <noelamac@gmail.com> escribió:
> El Thu, 21 Feb 2013 13:10:20 -0430, Miguel Matos escribió:
>
>> Saludos a la lista. Esta es una "preguntonta" de dos partes. La más
>> importante es esta: cuando me conecto a mi servidor casero con SSH con
>> root funciona normal: me pide la clave de root e ingreso sin problemas,
>> pero esto trae problemas. ¿Qué problemas? Este en particular: si bajo un
>> paquete con root sólo puedo usarlo si hago root desde el servidor mismo.
>> En pocas palabras: No me sirve.
>
1)
> Hum... a ver, podrías iniciar sesión como root y luego cambiarte a tu
> usuario habitual con "su - usuario". Aunque lo normal es hacerlo al revés
> pero que sepas que es posible :-)
>
De poder puedo, y si no se puede, no se puede.
Con mi usuario normal:
miguel@debian-LT:~$ su -root
su: opción inválida -- r
Usage: su [options] [LOGIN]

Options:
  -c, --command COMMAND         pass COMMAND to the invoked shell
  -h, --help                    display this help message and exit
  -, -l, --login                make the shell a login shell
  -m, -p,
  --preserve-environment        do not reset environment variables, and
                                keep the same shell
  -s, --shell SHELL             use SHELL instead of the default in passwd

miguel@debian-LT:~$ su
Contraseña:
root@debian-LT:/home/miguel#

Desde la terminal de root:
root@debian-LT:/home/miguel# ssh 192.168.1.100
root@192.168.1.100's password:
Linux --------.-----.net 2.6.32-5-686 #1 SMP Sun Sep 23 09:49:36 UTC 2012 i686
[oculto este dato por seguridad]

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Feb 21 10:57:43 2013 from [XXX]
root@servidor:~# su -miguel
su: opción inválida -- i
Usage: su [options] [LOGIN]

Options:
  -c, --command COMMAND         pass COMMAND to the invoked shell
  -h, --help                    display this help message and exit
  -, -l, --login                make the shell a login shell
  -m, -p,
  --preserve-environment        do not reset environment variables, and
                                keep the same shell
  -s, --shell SHELL             use SHELL instead of the default in passwd

root@servidor:~# su
root@servidor:~#

¿hice algo malo?

2)
>> Lo quiero hacer con mi usuario normal. Pero si trato de ingresar, me
>> impide hacerlo (el típico "permission denied"). ¿Hay algo que deba hacer
>> para ingresar con mi usuario normal?. Ya intenté con mi clave, la clave
>> del usuario normal, la clave de root, ¡y nada! ¿Qué estoy haciendo mal?
>
> ¿Has tocado anteriormente la configuración sshd? Prueba a darle
> verbosidad al comando a ver si te dice algo coherente ("ssh -vvv
> usuario@equipo")

Desde mi usuario normal:
[voy a pegarlo todo, porque pastebin no me funciona]
miguel@debian-LT:~$ ssh -vvv servidor@192.168.1.100
OpenSSH_5.5p1 Debian-6+squeeze2, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.100 [192.168.1.100] port 22.
debug1: Connection established.
debug1: identity file /home/miguel/.ssh/id_rsa type -1
debug1: identity file /home/miguel/.ssh/id_rsa-cert type -1
debug1: identity file /home/miguel/.ssh/id_dsa type -1
debug1: identity file /home/miguel/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version
OpenSSH_5.5p1 Debian-6+squeeze2
debug1: match: OpenSSH_5.5p1 Debian-6+squeeze2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze2
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit:
diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit:
ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit:
hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit:
hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit:
diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit:
hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit:
hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 126/256
debug2: bits set: 521/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: host 192.168.1.100 filename
/home/miguel/.ssh/known_hosts
debug3: check_host_in_hostfile: host 192.168.1.100 filename
/home/miguel/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug1: Host '192.168.1.100' is known and matches the RSA host key.
debug1: Found key in /home/miguel/.ssh/known_hosts:1
debug2: bits set: 521/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/miguel/.ssh/id_rsa ((nil))
debug2: key: /home/miguel/.ssh/id_dsa ((nil))
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred
gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/miguel/.ssh/id_rsa
debug3: no such identity: /home/miguel/.ssh/id_rsa
debug1: Trying private key: /home/miguel/.ssh/id_dsa
debug3: no such identity: /home/miguel/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
servidor@192.168.1.100's password:
debug3: packet_send2: adding 48 (len 63 padlen 17 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug3: Ignored env ORBIT_SOCKETDIR
debug3: Ignored env SSH_AGENT_PID
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env XDG_SESSION_COOKIE
debug3: Ignored env GTK_RC_FILES
debug3: Ignored env WINDOWID
debug3: Ignored env GNOME_KEYRING_CONTROL
debug3: Ignored env GTK_MODULES
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env SESSION_MANAGER
debug3: Ignored env USERNAME
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env PATH
debug3: Ignored env PWD
debug3: Ignored env GDM_KEYBOARD_LAYOUT
debug1: Sending env LANG = es_VE.utf8
debug2: channel 0: request env confirm 0
debug3: Ignored env GNOME_KEYRING_PID
debug3: Ignored env GDM_LANG
debug3: Ignored env GDMSESSION
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env GNOME_DESKTOP_SESSION_ID
debug3: Ignored env LOGNAME
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env WINDOWPATH
debug3: Ignored env DISPLAY
debug3: Ignored env XAUTHORITY
debug3: Ignored env COLORTERM
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Linux --------.-----.net 2.6.32-5-686 #1 SMP Sun Sep 23 09:49:36 UTC 2012 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
servidor@servidor:~$

¿Pego lo que me diga root? Mientras, intentaré descifrar lo que dice acá.

3) Según [1] me especifica que es posible editarlo para ampliar la
seguridad, pero no voy a tocarlo hasta que me funcione bien con
cualquier usuario, dice que sí.

>
>> La segunda es relacionada al correo. Si quiero darle a [SOLUCIONADO],
>> ¿debo darle a reenviar o tengo que tomar el último escrito para que
>> quede como a tod@s les gusta? La última vez que hice algo así a algunos
>> no les gustó, y quiero dejarlos contentos para cuando termine el
>> problema de arriba.
>
> No vas a poder contentar a todo el mundo >:-)
>
> Lo que yo hago es, al responder un hilo, editar el asunto y añadir
> "[Solucionado] blah, blah...." con el [Solucionado] en primer lugar para
> que sea vea antes, pero eso ya al gusto de cada cual.
>
> Saludos,
>
> --
> Camaleón
>
>
> --
> To UNSUBSCRIBE, email to debian-user-spanish-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: [🔎] kg5n5d$ihs$6@ger.gmane.org">http://lists.debian.org/[🔎] kg5n5d$ihs$6@ger.gmane.org
>
[1]http://tuxpepino.wordpress.com/2007/05/11/ssh-el-dios-de-la-administracion-remota/
P.D.: si nada de esto me funciona como espero, tomaré la opción de
TeamViewer o RealVNC.

-- 
Buen uso de las listas (como se ven en Debian):
http://wiki.debian.org/es/NormasLista
Ayuda para hacer preguntas inteligentes: http://is.gd/NJIwRz


Reply to: