If you try to connect via SFTP with some FTP/SFTP client and you are getting error “Command failed”, you’re sftp-server path in sshd_conf is wrong.
Open your sshd_config file and edit sftp-server path accordingly to your OS.
Ubuntu:
Subsystem sftp /usr/lib/openssh/sftp-server
CentOS:
Subsystem sftp /usr/libexec/openssh/sftp-server
Restart your ssh and it should work.