Find the answer to your Linux question:
Results 1 to 6 of 6
HELP!!! I get this error when I try to log in to our Centos server as root. Does anyone know how to fix this? The /root directory is not there. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    4

    Exclamation [SOLVED] Could not chdir to home directory /root


    HELP!!!

    I get this error when I try to log in to our Centos server as root. Does anyone know how to fix this? The /root directory is not there. Logging in as a different user works.

    Could not chdir to home directory /root: No such file or directory
    -bash-3.2#

    Thanks,
    DB

  2. #2
    Just Joined!
    Join Date
    Oct 2008
    Posts
    4
    I also get this error when exiting from a vim command (this may be related).

    E138: Can't write viminfo file /root/.viminfo!
    Press ENTER or type command to continue

  3. #3
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,929
    Root's home directory is missing. You can recreate it with 'mkdir /root', but it'll be empty.

    Normally, you should not log in directly as root. All direct root access should be disabled for remote logins and X sessions, although allowing root access from text-mode terminals can be a lifesaver when things go wrong. You should always log in as a real user and then use 'su' or 'su -' (and the root password, of course) to change to the root user.
    Linux user #126863 - see http://linuxcounter.net/

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Oct 2008
    Posts
    4
    Thanks Roxoff.

    I did tried recreating the /root directory. When I log in as root, I don't get that message anymore but my command line still starts out with

    -bash-3.2#

    instead of

    [root@server~]$

    Is something missing?

  6. #5
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,929
    Yes, you've got some default files missing. There are a set of user defaults in /etc/skel (or similar - I'm sorry I forget the exact place, and I'm at work using Windwos at the moment, so I cant look).

    The files you need are the default .bash_profile and .bashrc, these should be copied into /root. The leading '.' means the files are hidden, so you might have to do 'ls -a' to see them.
    Linux user #126863 - see http://linuxcounter.net/

  7. #6
    Just Joined!
    Join Date
    Oct 2008
    Posts
    4
    That worked. Thank you so much!

Posting Permissions

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