./bash: No such file or directory

I am trying to connect to my SSH server with a customized sshd_config file. But when I try to connect, it gives the following error:

./bash: No such file or directory

And I copied bash to their directory including /bin, /lib64 and /lib.

These are the lines I added to sshd_config:

Match User cooluser
ChrootDirectory /home/cooluser

The /home/cooluser directory also exists.

1

2 Answers

You are choosing to set up a chroot jail for the user that logs in. That means that you give that user his own private root directory, distinct from the system root. Accordingly, you will have to setup the interactive shell for that chroot environment. Among many other things, that involves having a /home/cooluser/bin directory. When logging in under that configuration, that directory is seen as bin because /home/cooluser has been set to be / with your chrootDirectory /home/cooluser statement.

You probably want to look for an easier solution, or read up a bit more about the approach you are taking now.

If you are intending to change directory, it should be cd ./bash. Otherwise it would just say if the directory exists or not (Or execute an executable file called bash if it exists). Also the ./ part of ./bash means that you are looking at the folder bash from your working directory. If you want the path from home use ~/bash instead.

Why are you copying bash to /bin and the other ones? I assume bash is preinstalled on Ubuntu based distros. It is the default one in the terminal.

I'm not familiar with SSH yet so I can't help with SSH configuration.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like