Re: HowTo Disable execution of commands whit ssh and scp/sftp

From: Burak Bilen (bilen_at_metu.edu.tr)
Date: 03/24/04

  • Next message: Dmitry Surovtsev: "Re: HowTo Disable execution of commands whit ssh and scp/sftp"
    Date: Wed, 24 Mar 2004 09:56:30 +0200
    To: Dario Lesca <d.lesca@solinos.it>
    
    

     
     you can use rbash(restricted bash) and allow users to run only the
    commands that you let them to use.
    for disabling sftp you can comment the following line in the sshd2_config:
    # subsystem-sftp sftp-server

    Dario Lesca wrote:

    >Hi, i am not subsribe to ML, but I have a simple question, if I must
    >subscribe to ML for post, I will do it.
    >
    >My question:
    >
    >Howto allow only the execution of one procedure via ssh an disable the
    >execution of any other command and the scp/sftp service?
    >
    >OK; ssh user@host
    >NO: ssh user@host cat /etc/passwd
    >NO: scp user@host:/etc/passwd /tmp
    >NO: sftp user@host
    >
    >I have found this solution, is a bad solution or not?
    >
    >The target (for example) is assign to remote generic user the
    >possibility to run a single command (setup, or another), and only that
    >one!
    >
    >[root@igloo root]# cat /usr/local/bin/ssh.sh
    >#!/bin/bash
    >echo $0 $*
    >export DISPLAY=
    >exec /usr/bin/setup
    >[root@igloo root]# chmod 755 /usr/local/bin/ssh.sh
    >[root@igloo root]# useradd -s /usr/local/bin/ssh.sh sshuser
    >[root@igloo root]# passwd sshuser
    >
    >Now Test all the metod
    >
    >
    >
    >>>OK; ssh user@host
    >>>
    >>>
    >[root@igloo root]# ssh sshuser@localhost
    >sshuser@localhost's password:
    >/usr/local/bin/ssh.sh
    >You are attempting to run "setup" which requires administrative
    >privileges, but more information is needed in order to do so.
    >Password for root:<CTRL C>
    >Connection to localhost closed.
    >[root@igloo root]#
    >
    >Ok, the command run propertly! ...
    >... via sudo then I can disable the password request ...
    >
    >Now test other case ... I do not want that these work ....
    >
    >
    >
    >>>NO: ssh user@host cat /etc/passwd
    >>>
    >>>
    >[root@igloo root]# ssh sshuser@localhost cat /etc/passwd
    >sshuser@localhost's password:
    >/usr/local/bin/ssh.sh -c cat /etc/passwd
    >[root@igloo root]#
    >
    >NOT WORK! good!
    >
    >
    >
    >>>NO: scp user@host:/etc/passwd .
    >>>
    >>>
    >[root@igloo root]# scp sshuser@localhost:/etc/passwd .
    >sshuser@localhost's password:
    >/usr/local/bin/ssh.sh -c scp -f /etc/passwd
    >[root@igloo root]# ls passwd
    >ls: passwd: No such file or directory
    >[root@igloo root]#
    >
    >NOT WORK! good!
    >
    >
    >
    >>>NO: sftp user@host
    >>>
    >>>
    >[root@igloo root]# sftp sshuser@localhost
    >Connecting to localhost...
    >sshuser@localhost's password:
    >Received message too long 796226418
    >[root@igloo root]#
    >
    >NOT WORK!
    >
    >This is all .... some suggest?
    >
    >Many thank for your attention.
    >
    >
    >


  • Next message: Dmitry Surovtsev: "Re: HowTo Disable execution of commands whit ssh and scp/sftp"

    Relevant Pages

    • Re: Preventing an application from staying in memory if closed improperly
      ... It is possible for the user to hit the X during ... I think disabling the X might be a good option. ... one point though that I'd like to mention about the "disable the Command ... Button's Enabled property is set to True. ...
      (microsoft.public.vb.general.discussion)
    • Re: Upgrade to XP fails for windows 2000 sp4
      ... If it does work you will find that with the Event Log disabled it will take a bit of time for the logon window to appear, ... If it doesn't work you can enable the service again from the RC by issuing the Enable command: ... If disabling the event log fails to get you past the error you can slave the disk in another Windows 2000/XP machine and use regedt32 to remotely edit: ... The article is for NT3.x 4.0 but it also applies to Windows 2000 and I'm 99.9% sure that it also applies to XP. ...
      (microsoft.public.windowsxp.basics)
    • Re: Lag only when on-line
      ... consider disabling TeaTimer, ive found it to be an irritating cause of some ... Startup, Digital Line Detect ... Lists this as a microsoft system app, but i dont have it on my system ...
      (microsoft.public.windowsxp.help_and_support)
    • Re: mute usb microphone with keyboard
      ... surround your device IDs with double quotes like so: ... Repeated the command and it said disabled but microphone still ... The microphone actually plugs into a USB pod which then plugs into the USB ... Jack and repeat all of the above disabling attempts to no avail. ...
      (microsoft.public.windowsxp.general)
    • Re: Preventing an application from staying in memory if closed improperly
      ... It is possible for the user to hit the X during ... I think disabling the X might be a good option. ... one point though that I'd like to mention about the "disable the Command ... Button's Enabled property is set to True. ...
      (microsoft.public.vb.general.discussion)