How to use Directadmin jailed SFTP

Groen01

Verified User
Joined
May 7, 2009
Messages
7
Hello,

I've got a RedHat ES5,3 server with Directadmin. One of our customers wants to use SFTP so I edit the /usr/local/directadmin/custombuild/options.conf:
jail=yes
and run:
./build all_jail
After this i run the script jail/jail_user.sh username. When i connect with SSH it works great but when I connect with sftp I get:
Server sent command exit status 1

This is my secure log file:
sshd[24539]: Accepted password for username from "ipaddress" port 58026 ssh2
sshd[24539]: pam_unix(sshd:session): session opened for user username by (uid=0)
sshd[24541]: subsystem request for sftp
sshd[24539]: pam_unix(sshd:session): session closed for user username

This is /etc/passwd:
username:x:505:506::/home/username:/bin/jail
This is /home/username/etc/passwd:
username:x:505:506::/home/username:/bin/bash
This is the end of /etc/ssh/sshd_config:
Subsystem sftp /usr/libexec/openssh/sftp-server
AllowUsers admin
AllowUsers username

Can someone help me out?
Thanks!
 
sftp probably isnt able to work with that shell type
 
Hello,

Thanks for the reply. What kind of shell type do you think I should use?

Thanks!
 
Hello,

When i change username:x:505:506::/home/username:/bin/jail to username:x:505:506::/home/username:/bin/bash it works but i'm offcourse not jailed. So the problem is /bin/jail. Is there somebody who's got experience with this problem?
 
Anyone figure this out?

Yeah, I just figured this out today. Basically the sftp-server binary in /usr/libexec/openssh is missing files required to run so you have to login manually as the user under a jailed shell to execute the binary manually and just keep fixing what it complains about until it works.

I am using CentOS 5.4 64 bit and was missing some library files in /lib64 and /usr/lib64. If also needed /dev/null to exist which is not created by the jail_user.sh script.

Once you figure out what files are missing you need to edit the scripts to create/copy the files needed by the sftp-server binary.
 
Last edited:
Back
Top