Cannot connect to server via SSH

Posted by Rayne on Server Fault See other posts from Server Fault or by Rayne
Published on 2012-04-12T11:39:19Z Indexed on 2012/04/16 5:34 UTC
Read the original article Hit count: 541

Filed under:
|
|

I'm running RHEL 6.0, and I accidentally moved the /bin, /boot, /cgroup, console.txt, /data, /dev, /etc to another folder. I think I managed to move these folders back, but now I'm having trouble connecting to the server using SSH, but am able to access the server via VNC.

When I tried to connect to the server using a terminal from another server, I get the error

ssh_exchange_identification: Connection closed by remote host

I'm currently still connected via SSH to the server (haven't closed the window yet), and am still able to access it normally. But if I try to open a new SSH terminal from my current session, I see

/bin/bash: Permission denied

If I try to open a new SSH File Transfer window from my current session, I get the error

File transfer server could not be started or it exited unexpectedly. 
Exit value 0 was returned. Most likely the sftp-server is not in the path of the user on the server-side

I checked and I have

Subsystem  sftp  /usr/libexec/openssh/sftp-server

which is the same path as the output of

locate sftp-server

Also, when I tried to restart sshd, I get the error

Couldn't open /dev/null: Permission denied

But my /dev/null has the permissions

crw-rw-rw-

for root,root.

How can I resolve this?

ETA: Thanks for all your help! I was able to start ssh by running the application directly

/usr/sbin/sshd

Even though the status of the openssh-daemon is still "stopped".

© Server Fault or respective owner

Related posts about ssh

Related posts about login