Go to "Web Sites & Domains" in Control Panel, then select "FTP Access".
In the "Account" chose "/ bin / bash (chrooted)" to activate the SFTP protocol
(Note: The user name must be filled, however the password may be empty if the FTP account has already been created earlier)
Couldn't open /dev/null: Permission denied
$ sftp -v [email][email protected][/email]
Connecting to mydomain.com...
OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to mydomain.com [mydomain.com] port 22.
debug1: Connection established.
debug1: identity file /home/ian/.ssh/id_rsa type -1
debug1: identity file /home/ian/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu7 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu7
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'mydomain.com' is known and matches the RSA host key.
debug1: Found key in /home/ian/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/ian/.ssh/id_rsa
debug1: Trying private key: /home/ian/.ssh/id_dsa
debug1: Next authentication method: password
[email][email protected][/email]'s password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
[email][email protected][/email]'s password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Requesting [email][email protected][/email]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LC_ALL = en_US.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email][email protected][/email] reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 1648, received 2008 bytes, in 0.0 seconds
Bytes per second: sent 38234.0, received 46586.1
debug1: Exit status 0
Connection closed
Try replacing /bin/bash with /usr/libexec/openssh/sftp-server (on RedHat) or /usr/lib/openssh/sftp-server (on Debian) as shell. It's not ideal, you'd ideally want a *working* chroot environment, but still no less secure than using /bin/bash.I just gave up with chrooting and just used normal /bin/bash access. As long as the users are trusted users and you make sure they have a long/strong password then SFTP will work. They still won't have root access.
user with id=10000 and name=gv not found in chrooted passwd file
gv:x:10000:000::/var/www/vhosts/domain.tld:/usr/local/psa/bin/chrootsh
^ ^ ^ ^ ^ ^
| | | | | |------- Path to shell (Always the same)
| | | | |------- Home Directory (only domain.tld should change to appropriate domain)
| | | |------- Group ID (Same as original sftp account holder)
| | |-------User ID (Same as original sftp account holder)
| |-------- Always x / a would indicate a non-chrooted environment
|-------- The username
altris:x:10000:505::/var/www/vhosts/altrisinc.com:/bin/bash
gv:x:10000:505::/var/www/vhosts/altrisinc.com:/usr/local/psa/bin/chrootsh
altris:x:10000:505::/:/bin/bash
gv:x:10000:505::/:/bin/bash
root:x:0:root
psaserv:x:503:apache,psaftp,psaadm
psacln:x:504:
root:*:0:0:Root:/:/bin/false
domainuser:x:10024:504::/:/bin/bash