Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to allow chroot-ed user both SSH and SFTP access [closed]

Tags:

unix

chroot

I currently know how to allow a user either SSH or sFTP by editing:

/etc/ssh/sshd_config

This lets the user login with SSH but not SFTP:

Subsystem sftp /usr/lib/openssh/sftp-server
Match group chrootedgroup
      ChrootDirectory /var/chroot/

This lets the user use sFTP but not SSH:

Subsystem sftp internal-sftp
Match group chrootedgroup
      ChrootDirectory /var/chroot/
      ForceCommand internal-sftp

How can I make a user capable of logging in using both?

like image 767
davidvelilla Avatar asked Nov 11 '22 03:11

davidvelilla


1 Answers

I encountered same problem, figured out through the help of https://www.howtoforge.com/restricting-users-to-sftp-plus-setting-up-chrooted-ssh-sftp-debian-squeeze#-enabling-chrooted-ssh Solution mentioned in the last few lines of the section 'Enabling Chrooted SSH'.

To support both SSH and SFTP, your configuration should be:

Subsystem sftp internal-sftp
Match group chrootedgroup
      ChrootDirectory /var/chroot/
like image 56
Henry Luo Avatar answered Jan 04 '23 03:01

Henry Luo