0

On my macos i am able to login to sftp as sftp localhost. When i run !pwd it shows me default directory is /Users/username but i want to change it /Users/username/Sites/wordpress.

I edited /etc/ssh/sshd_config file & added below lines at bottom of file

Match User username
       X11Forwarding no
       AllowTcpForwarding yes
       PermitTTY yes
       PasswordAuthentication yes
       ChrootDirectory /Users/username/Sites/wordpress

But when i again try to login with sftp localhost after password prompt it gives me error as below

client_loop: send disconnect: Broken pipe
Connection closed 

Please tell me how can fix this error ?

EDIT:

Subsystem sftp internal-sftpr

# Example of overriding settings on a per-user basis
Match User username
    X11Forwarding no
    AllowTcpForwarding yes
    PermitTTY yes
    PasswordAuthentication yes
        ChrootDirectory /Users/username/Sites/wordpress
TechChain
  • 51
  • 2

1 Answers1

0

You should configure sshd to use internal-sftp for SFTP, not the old external sftp-server binary.

Subsystem sftp internal-sftp

The internal-sftp can use a chroot directory without requiring any supporting files to be placed in that directory.

You may also read about all the other differences between internal-sftp and the old sftp-server.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940