I have a folder /srv/jarvis which has punch of subfolder and on of them is called carl (/srv/jarvis/carl)
jarvis Dir has these rights
drwxrwxrwx 12 root root 4096 Jun 9 11:34 jarvis
And Carl has these rights
drwxr-xr-x 4 carl carl 4096 Jun 9 13:02 carl
In the /etc/ssh/sshd_config i have added these lines
Match user carl
ChrootDirectory /srv/jarvis/carl
ForceCommand internal-sftp
AllowTCPForwarding no
X11Forwarding no
But if i add those lines and do service ssh restart
then the user cant login into that server Write fails: Broken pipe. And if remove tose lines from sshd_config he can login again but i dont want that
I want that the use can access only to /srv/jarvis/carl/ and do there what ever he wants Also he cant do any of the root stuff :)
How can i fix thoes problems
Match User "carl"
), but the documentation I can find seems to indicate this may be unnecessary. Do you have aSubsystem sftp internal-sftp
line somewhere in yoursshd_config
? – rocketman10404 Jun 09 '14 at 14:18Subsystem sftp internal-sftp
instead of the external sftp-server. Regarding theinternal-sftp
statement, the documentation statesAlternately the name 'internal-sftp' implements an in-process 'sftp' server. This may simplify configurations using ChrootDirectory to force a different filesystem root on clients.
. I'd try commenting out yourSubsystem
statement and trying it withSubsystem sftp internal-sftp
instead. – rocketman10404 Jun 10 '14 at 15:39carl
folder should be owned by root (chown root /srv/jarvis/carl
). Your current permissions there look fine. It won't allow write-access forcarl
, so you may need to put a subfolder there owned by him to write stuff to. If you still have no luck, see if you can find anything helpful in/var/log/auth.log
. – rocketman10404 Jun 11 '14 at 18:27carl
permissions if you change yourChrootDirectory
to/srv/jarvis/%u
, and modify the permissions onjarvis
withchmod 755 /srv/jarvis
. – rocketman10404 Jun 11 '14 at 18:5421:10:18 localhost sshd[16609]: fatal: bad ownership or modes for chroot directory component "/srv/" Jun 11 21:10:18 localhost sshd[16596]: pam_unix(sshd:session): session closed for user carl
– Infira Jun 11 '14 at 21:10