1

I have a bin directory in my chroot directory that contains commands like bash date ls...etc

If i simply chroot to my chroot directory. i am still able to invoke commands listed in the /bin.

However when i access through ssh (I ssh into another user that is attached to the chroot directory), i am unable to execute any commands from the /bin. It prompted "command not found".

on the other hand, if I cd into the bin directory - cd bin... I can invoked the ls command - ./ls (this is just to prove that I am in the correct chroot directory after I ssh in.)

I am following this link to set up chroot for my ssh access. https://www.tecmint.com/restrict-ssh-user-to-directory-using-chrooted-jail/

Any solution to this?

2
  • It sounds like your PATH is not set to include /bin. You can check with echo $PATH. Oct 3, 2018 at 0:36
  • yes it seems that the path is not correct, how I change it? Oct 3, 2018 at 0:37

1 Answer 1

0

The problem is that /bin is not in the user's $PATH environment variable; a variable which tells the shell where to look for executables.

Since you're using BASH you can simply edit /etc/profile in the chroot to add the following:

export PATH=$PATH:/bin

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .