Iam trying to ssh from macOS into Kali Linux. Both devices are on the same subnet, connected by a home router.

I initiated the ssh service on the device running Kali and set up /etc/ssh/sshd_config to use a password on login. (I set PasswordAuthentication yes and ChrootDirectory /home/remote in /etc/ssh/sshd_config)

Running the following command on the Mac ssh user@192.168.xxx.xxx logs me in and disconnects after issuing the following error /bin/bash No such file or directory

I can confirm that /bin/bash does exist’s and is listed in /etc/shells.

Error logs from /var/log/auth.log points to this error /dev/pts/zsh No Such file or directory

I have been told this might be a install issue, I have already tried reinstalling, It doesn’t work.

Can someone help me figure this out.

  • If you log in directly to the Kali device and run /bin/bash do you get an error or a shell? If you log into the Kali device and run su - user and give the password do you get an error or a shell? Please show the exact error messages. My first guess is that this is a line ending issue.
    – icarus
    Nov 27 '20 at 15:10
  • 1
    You "set up /etc/ssh/sshd_config to use a password on login". What exactly did you do?
    – roaima
    Nov 27 '20 at 15:19
  • @icarus no I do not get error for both the cases Nov 27 '20 at 16:15
  • @MarkPlotnick yes I get the same error for ssh user@ Nov 27 '20 at 16:15
  • 1
    That's vital information and explains the reason for the problem. Please add it to your question
    – roaima
    Nov 27 '20 at 16:32

Thanks to @icarus, yes the issue was with the ChrootDirectory setting in /etc/ssh/sshd_config. Commenting out ChrootDirectory /home/remote worked. I worked out the cause for this issue from this question. Thank you everyone, I can't believe I missed something this silly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.