Results 1 to 4 of 4

Thread: scponly with chroot setup but user can STILL forward ports...

  1. #1
    Join Date
    Dec 2006
    Location
    /dev/null
    Beans
    351

    scponly with chroot setup but user can STILL forward ports...

    I'm using scponly and have chrooted a user to his home directory. I noticed however that I can ssh into the box enabling port forwarding which is a dangerous security breach in my opinion. I'd like to have the ability keep port forwarding for other users, but for the scponly user, I'd like to disallow ssh port forwarding. Anyone know how?

    Code:
    $ ssh nightshade -P 8081
    username@nightshade's password:
    Welcome to nightshade

  2. #2
    Join Date
    Dec 2006
    Location
    Chicago
    Beans
    3,839

    Re: scponly with chroot setup but user can STILL forward ports...

    I believe the only way to prevent TCP forwarding is to set AllowTcpForwarding, which is a global setting. If you need to disable it for only some users, then you will need to run a seperate instance of sshd with a seperate configuration file listening on a different port.

  3. #3
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: scponly with chroot setup but user can STILL forward ports...

    Quote Originally Posted by cdenley View Post
    I believe the only way to prevent TCP forwarding is to set AllowTcpForwarding, which is a global setting. If you need to disable it for only some users, then you will need to run a seperate instance of sshd with a seperate configuration file listening on a different port.
    Actually you can set it on a per user basis if you use ssh keys. The documentation on this is hard to find however.

    search on ssh forced commands

    Basically on the server you add to your keys in ~/.ssh/authorized_keys

    command=scp,no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty

    See this blog for how I set this up for a svn server :

    http://blog.bodhizazen.net/linux/svnssh/
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  4. #4
    Join Date
    Dec 2006
    Location
    /dev/null
    Beans
    351

    Re: scponly with chroot setup but user can STILL forward ports...

    Thanks for the replies, all. Turns out this can be accomplished by the addition of two new lines to the sshd_config:

    Code:
    Match user USERNAME
    AllowTcpForwarding no

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •