ssh restringido

      • 769
      • mensajes
      • miembro desde
      • 13/06/02
    • Senior Member
    05/02/2003
    #1 ssh restringido

    tengo un servidor corriendo ssh y yo me logeo como root y hago todo, hasta ahi joya, la cosa es que un usuario me pidio que le cree una cuenta ssh pero yo se la quiero restringir solo a un directorio especifico, el que el necesita, como haria eso?

  1. ¿Este tema te pareció interesante? Compártelo!

    ¿No es lo que buscabas? Intenta buscar un tema similar

    5 comentarios / 4036 Visitas

      • 274
      • mensajes
      • miembro desde
      • 01/08/02
    05/02/2003
    #2

    Asi nomas no es el tema, es decir no es como un ftpd en el que vos restringis el acceso (y no nesecitas ejecutar comandos)

    la solucion tuya seria crear un directorio y dentro de ese copiar una estructura de directorios tipo raiz, con todos los archivos dentro, luego invocar a chroot y ahi dentro ejecutar un ssh, o telnet.

    otra es no limitarlo con chroot y no copiar nada, sino que cambiar los permisos de parte del sistema de archivos criticos.

    Una tarea que lleva su tiempo.

    Otra forma es crear un linux dentro de otro (User-Mode-Linux), en donde se ejecuta. (esta bueno para hacer pruebas)

    Para mi la mas comoda es un chroot, yo te tire las que se me ocurrieron.
    http://www.tjw.org/chroot-login-HOWTO/

    bueno contame cual elejiste, y si te sirvio. cualquier cosa pregunta.

      • 274
      • mensajes
      • miembro desde
      • 01/08/02
    05/02/2003
    #3

    oops se me olvido una cosa si haces chroot, binarios con setuid (y root) no pongas dentro en lo posible, ya que si obtiene root, el chroot se salta.

      • 1,672
      • mensajes
      • miembro desde
      • 01/02/02
    05/02/2003
    #4

    del man bash:

    RESTRICTED SHELL
    If bash is started with the name rbash, or the -r option
    is supplied at invocation, the shell becomes restricted.
    A restricted shell is used to set up an environment more
    controlled than the standard shell. It behaves identi_
    cally to bash with the exception that the following are
    disallowed or not performed:

    · changing directories with cd

    · setting or unsetting the values of SHELL, PATH,
    ENV, or BASH_ENV

    · specifying command names containing /

    · specifying a file name containing a / as an argu_
    ment to the . builtin command

    · Specifying a filename containing a slash as an
    argument to the -p option to the hash builtin com_
    mand

    · importing function definitions from the shell envi_
    ronment at startup

    · parsing the value of SHELLOPTS from the shell envi_
    ronment at startup

    · redirecting output using the >, >|, <>, >&, &>, and
    >> redirection operators

    · using the exec builtin command to replace the shell
    with another command

    · adding or deleting builtin commands with the -f and
    -d options to the enable builtin command

    · specifying the -p option to the command builtin
    command

    · turning off restricted mode with set +r or set +o
    restricted.

    These restrictions are enforced after any startup files
    are read.

    When a command that is found to be a shell script is exe_
    cuted (see COMMAND EXECUTION above), rbash turns off any
    restrictions in the shell spawned to execute the script.



    Igual yo haría un chrooted environment , solamente para los comandos que necesite el user.

    ¿Para que te pide una cuenta de shell? Pedile que te pase los comandos a ejecutar y lo hacés vos. Si el argumento es que quiere aprender , que se instale linux en su pc.


    Salu 2

      • 274
      • mensajes
      • miembro desde
      • 01/08/02
    06/02/2003
    #5

    claro lo que dice flint esta bien y es mas sencillo, pero lo habia descontado, ya que es solo para dentro de la shell, o sea segun como este restringida, ejecutas cualquier cosa y chau restriccion,tipo...ejecutas el mc, o algun programita que sea y te moves tranquilamente por los directorios. el funcionamiento es dentro de la shell nomas. (habria que estudiar el tema mucha bola no le di)

    hay que ver como prepararla bien ya que tiene su configuracion...

    si posiblemente le daria alguna utilidad para algun script (#!/bin/bash -r) para que no se mande alguna cgd.

    en fin como dice, flint... que tambien te recomienda un chroot, o que se instale gnu/linux o si no, que no instale , use el knoppix que no se instala(se ejecuta de CD) y tenes todo y va a ser felix! (va depende el caso)

    saludos.

      • 443
      • mensajes
      • miembro desde
      • 17/02/02
    06/02/2003
    #6

    huu joya , no me parece que la posta para esta en el chroot es lo mejor