Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Cannot connect to server via SSH

    Hi all,

    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

    for root,root.

    How can I resolve this?

    Thank you.


  2. #2
    Just Joined!
    Join Date
    May 2011
    Austin, TX
    1. Confirm whether or not you a) did move these directories and b) actually got them moved back or not
    2. Restore from backups.
    3. If no backups, check tripwire logs to find out what isn't in the right place and move it back.
    4. If no backups or tripwire, perform a fresh install on identical hardware and diff/rsync to compare the two filesystems to find out what is out of place and move it back.
    5. Boot the system from a liveCD and mount the filesystem, move files back to proper places and correct permissions.
    6. If the data isn't important enough to have backups, tripwire, hardware, nor livecd then just overwrite it and reinstall - should take less time than poking around trying to correct this.

  3. #3
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Additionally to what dayid contributed:
    It is possible to verify the system directory structure against the rpm database.

    "rpm -Va" should only output very few files as different to the definitions in the rpms,
    and only logfiles, configfiles, etc should show up at all.
    You must always face the curtain with a bow.

  4. $spacer_open
  5. #4
    Thanks for all your help! I was able to start ssh by running the application directly

    Even though the status of the openssh-daemon is still "stopped". This isn't the cleanest solution, but it'll do for now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts