Score:0

./bash: No such file or directory

tr flag

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.

terdon avatar
cn flag
What are you trying to do with the `ChrootDirectory` directive? That means "use this as the root directory under which everything else should be found". Since you presumably don't have things like `/home/cooluser/bin` or `/home/cooluser/lib` etc., this is almost certainly not what you want to do. Please [edit] your question and explain what your final objective is, tell us why you are modifying the ssh config.
Score:1
cn flag

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.

CreeperPower storing avatar
tr flag
I am copying bash to their home directory because else it also said /bin/bash was not found
CreeperPower storing avatar
tr flag
And yes bash exists, because I can see it in my FTP
TD15 avatar
cn flag
Can you define your problem better? Bash is a binary that is in `/usr/bin`. Why would you need a folder called bash?
CreeperPower storing avatar
tr flag
I do not have a folder called bash, it is a file in the users home directory, it is also in /usr/bin or /bin but i copied it because it gives an error (probably because of ChrootDirectory).
TD15 avatar
cn flag
Sorry for some reason I thought it is a folder. If you can see the file in your file manager press `ctrl + L` and use the absolute path instead. I wish I can help more but I am also relatively new to Linux.
Score:1
cn flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.