I have a server running debian 6, I logged in on my window desktop using Bitvise SSH client. I was trying to get node.js and npm installed trying different things with apt-get. I got frustrated and disconnected, I came back later to try again and now when I try to login with Bitvise SSH client I get this error.

/bin/sh: No such file or directory Connection closed.

I get this error with every account on the server even the root account.

I can however use SFTP and browse the server and edit/upload/delete files. I logged into another debian server, our DB server and tried to SSH to the machine and I get the same error message with every account.

Any ideas what I can do to fix this?

  • Do you have a physical access to the server, if yes, please give the output of this two commands which sh and cat /etc/passwd. Just note this, if you give the output of the second command, we will be able so see al the available users in your server, it's kinda a security issue, if the server can be accessible publicly, and you don't want the public to see the available users, then tell me so we can find the solution differently.
    – Sidahmed
    Commented Dec 30, 2016 at 16:43
  • I do have physical access to it but not until I go into the office and I am at home right now.
    – Trevor Orr
    Commented Dec 30, 2016 at 16:47
  • This might help your problem. unix.stackexchange.com/questions/278454/…
    – Gia Cao
    Commented Dec 30, 2016 at 16:52
  • I am pretty sure that you changed the default shells of your users or accidentally removed the shell /bin/sh. But I don't know how to help you if you don't access your server physically. So, there is two solutions here : may be an expert will find you a solution before the end of the weekend, if they don't until then, when you go to work give me the result of the first command, and I will ask you some questions about the second command, so we can find the solution.
    – Sidahmed
    Commented Dec 30, 2016 at 16:56
  • very important : since it's a work server, don't past the result of the second command, because it can be used to hack into your server.
    – Sidahmed
    Commented Dec 30, 2016 at 16:57

1 Answer 1


Judging by the discussion in the chat room, shell binaries are present on the disk but can not be executed. This looks like very bad news for you as it is the symptom of a missing library, probably libc. ssh will be of no use then since, whatever the way, executing a command requires a functional shell.

If you have a libc issue, login locally (i.e. physical access) will fail too but you may succeed in fixing things with the shell embedded in your initrd image (busybox probably) or with a live Linux on USB drive.

Before, you can still try to fix your server remotely by copying back the missing library with sftp. That may work if you are lucky, but you may also need to execute ldconfig and this can only be done locally.

Finally, once everything is in order, you may want to install the bash-static package, so that your shell no longer depends on an external library.

[update] An idea that may allow you to connect to your server with ssh: Via sftp you can copy the shell from the bash-static (/bin/bash-static) package to /bin on the remote server. You can then modify the remote /etc/passwd to change root's shell to /bin/bash-static and then connect with ssh. You can also do the same with /bin/busybox from the busybox-static package, and have some basic tools (mv, cp, etc.) to fix things.

  • Is there a way to find out exactly what library or libraries are missing?
    – Trevor Orr
    Commented Dec 31, 2016 at 18:59
  • @TrevorOrr ldd /bin/your_shell will tell you what external libraries are needed for it to run. You can remotely mount (via sftp + FUSE) your broken server and thus do the ldd remotely.
    – xhienne
    Commented Jan 1, 2017 at 18:11

You must log in to answer this question.

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