Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Servers > [SOLVED] Could not chdir to home directory /root
 Servers   Anything server related, Apache, MySQL, Samba, server security, sendmail, exim, etc

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Closed Thread
 
Thread Tools Display Modes
Old 10-31-2008   #1 (permalink)
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
db2007 is offline  

Old 10-31-2008   #2 (permalink)
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
db2007 is offline  
Old 10-31-2008   #3 (permalink)
Trusted Penguin
 
Roxoff's Avatar
 
Join Date: Aug 2005
Location: Nottingham, England
Posts: 2,749
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://counter.li.org/
Roxoff is offline  
Old 10-31-2008   #4 (permalink)
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?
db2007 is offline  
Old 10-31-2008   #5 (permalink)
Trusted Penguin
 
Roxoff's Avatar
 
Join Date: Aug 2005
Location: Nottingham, England
Posts: 2,749
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://counter.li.org/
Roxoff is offline  
Old 11-03-2008   #6 (permalink)
Just Joined!
 
Join Date: Oct 2008
Posts: 4
That worked. Thank you so much!
db2007 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Free Network Mapping Tool for Microsoft® Office Visio® Professional 2007 Users
Don't map your network by hand – let LANsurveyor Express for Microsoft Visio Professional 2007 automatically create network diagrams for you.
subscribe
Free eBook:"Vulnerability Management for Dummies"
Get all the Facts and See How to Implement a Successful Vulnerability Management Program.
subscribe
Google vs The World: The Battle of the Message Security Vendors
With such a powerful name behind it, Google Message Security stands out in a sea of products that do exactly the same thing - or so they say.
subscribe

Safe, Secure Backup


All times are GMT. The time now is 02:30 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2