SFTP chroot and SSH keys

Status
Not open for further replies.
Joined
Jul 16, 2016
Messages
17
Dear all,
I've spent all day trying to figure out how to chroot a sftp user. But I couldn't. The best result I got is each user can access its home folder (can read and write), but he can also see my /mnt folder and volumes folders (but he can't access them).

Honestly I would like to have those upper folders invisible, and let him only sees his home folder.

I've been trying extra setting in SSH window, adding code to ssh_config... but without any success.

I'm running FN 9.1 stable.
I attach here a few screenshots to show my settings.



Once I'll figure it out, I'd like to use public key method to login. How can I do that?

Thank you
 

Attachments

  • Schermata 2016-08-02 alle 15.25.04.png
    Schermata 2016-08-02 alle 15.25.04.png
    52.4 KB · Views: 292
  • Schermata 2016-08-02 alle 15.25.14.png
    Schermata 2016-08-02 alle 15.25.14.png
    62 KB · Views: 289
  • Schermata 2016-08-02 alle 15.24.37.png
    Schermata 2016-08-02 alle 15.24.37.png
    72.6 KB · Views: 301
  • Schermata 2016-08-02 alle 15.24.54.png
    Schermata 2016-08-02 alle 15.24.54.png
    52.1 KB · Views: 275

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
Have you considered using http://doc.freenas.org/9.10/freenas_services.html#scp-only instead? In other words, do users need a shell account or do they only need to scp/sftp? Note that most non-Unix utilities will bypass the chroot though...
Even if you add something like this to your sshd_config:
Code:
Match Group sftponly
  ChrootDirectory /mnt/Tank/foo
  ForceCommand internal-sftp
  AllowTcpForwarding no
  PermitTunnel no


I assumed the "ForceCommand" parameter prevents using the SSH session for other purposes than SFTP.
 
Status
Not open for further replies.
Top