I've set up a number of different users which each have their own jail directory. Inside this jailed directory they each have all the binaries and libraries they need copied over. SSH access is working for these users by using a Match block and using the ChrootDirectory option.

Since enabling this all my regular users are getting /bin/bash permission denied. I've checked the permissions on all the directories including /, /bin and the user's home directory. All seem to be okay.

I've also tried copying the binaries to the regular user directory just in case the match block isn't working correctly, however this did not make any difference.

When connecting over SSH the MOTD is displayed and then the permission denied message is displayed.

  • 1
    Does /bin/bash exist in an executable state in the jail? What are the owner and permissions? – DopeGhoti Jun 6 '16 at 0:30
  • The user that I'm trying to connect with shouldn't have any jails applied to them, this is just a regular user. The jailed users can SSH in fine – Stephen Mahood Jun 6 '16 at 6:26
  • Okay. Same question in the live non-chrooted filesystem, then. Does /bin/bash exist? What are its permissions? Who is its owner? – DopeGhoti Jun 6 '16 at 7:33
  • Yep, /bin/bash exists. /bin is root:root and 755, /bin/bash is root:root and 0644. – Stephen Mahood Jun 6 '16 at 9:28
  • "/bin/bash is root:root and 0644" that will be the problem ... – Jakuje Jun 6 '16 at 17:10

This will be the problem:

/bin/bash is root:root and 0644

On sane systems

$ ls -l /bin/bash 
-rwxr-xr-x 1 root root 1037464 Sep  1  2015 /bin/bash

the bash should be executable by everyone, which is 755

chmod 755 /bin/bash

should make it working for you.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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