Changing root's home directory

I have no desire to change's root's shell, but I'm looking at changing root's home directory on a Solaris v8 box. I want to look into not only the wisdom (or lack thereof) of doing this, but also the practical aspects.

The box is a Solaris v8 with Maintenance Update #7 and the current (10/21/2003) Recommended Patches applied. Among other modifications, I have killed the automounter permanently, as this box will not be NFS-exporting (or importing, for that matter) any of its disks. Hence, my user home directories are in /home, as opposed to /export/home - less typing.

By default, root's home directory is /

However, I don't like this, because if I login under CDE, or use something like Netscape, files (e.g. .Xauthority, the Netscape cache directory, etc.) get put in / - which clutters the place up.

I'd like to create /home/root and make root's home directory there instead. However, if I use vipw to make this change, it yells and screams and jumps up and down - and also won't save the change, claiming I've "mangled" the passwd file.

I understand that if I do this and then lose /home (which is its own slice on a different physical disk than /), I'll be in a pickle and unable to login as root. My BC plan in that case is to boot on the CD-ROM, tickle /etc/passwd back to having root's home directory as /, and then log in normally to start recovery. So I have that angle covered.

Are there any other "gotcha" scenarios that I'm overlooking? Is there any other danger in changing root's home directory? I'd leave the shell as /sbin/sh. Obviously, if I manually do this, I won't be able to use vipw any more. Will admintool get upset?

Has anyone else done this?
LVL 34
PsiCopAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

shivsaCommented:
try chroot command.
0
PsiCopAuthor Commented:
shivsa,

Thanks for responding. I don't think you understand what I'm trying to accomplish. I do NOT want root's home dir changed for the duration of one command or script. I want to PERMANENTLY change root's home directory. I don't see how chroot is going to help me do that.
0
shivsaCommented:
Thanks PsiCop, i totally misunderstood u.

root dir(/) is referenced many places in kernel. i do not know if  u can have a working kernel with root changes to something else.

may be u can try sybolic link or something on running kernel and as u said during boot u have workaround.

0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

shivsaCommented:
also after changing root dir, vipw will complain all the time, so use usermod command.
0
riaanvdCommented:
Root is just a user as all other users on a system. The difference is that root has a little bit more privileges than the others and that the home dir is /. As you have it covered if your /home fs gets corrupted or lost it will be fine changing root's home dir to /home/root. Use usermod to make the changes or edit the /etc/passwd file directly. The / directory gets referenced in the kernel but the root user gets referenced in the /etc/passwd file like any other user. It's like taking a normal user and give it a uid of 0 in the password file even though it's home dir is /foo/bar, the user will be referenced as Super-User with home dir /foo/bar.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
glassdCommented:
One thing to watch is that root's home directory is still in the root filesystem. The Linux convention of using /root accomplishes that.
0
TintinCommented:
I'll second glassd'd recommendation of making the homedir /root
0
riaanvdCommented:
The reason for having it in / is when you have to boot in single user mode, you at least will have a user with Super-User privileges for system maintenance. If the system crash and you have it covered and happy to do a bit of work to get it up and running again, I guess it's fine. The root user will work in another home dir on another fs on another disk but for crash reasons I guess it should be somewhere under the / fs directly. There is nothing that could prevent you from changing it though, because you thought of your recovery process already which will work fine.
0
yuzhCommented:
It is very easy to PERMANENTLY change root's home directory. I do it all the time whenever
I install/reinstall a UNIX box, eg, to make root's home dir as /root

mkdir /root     #  create the home dir first

edit /etc/password, to make the root's home as /root,

vi /etc/password

make the entry for root looks like the followings (the 1st line)

root:x:0:1:Super-User Hades:/root:/sbin/sh
daemon:x:1:1::/:/bin/false
..................
fred:x:1001:10:Fred Bush:/export/home/icrawf:/bin/tcsh

You can also put your own version of login scripts, and whatever under the root's home.

Cheers!
0
yuzhCommented:
PS: please remember to put the root's home under the /  filesystem (eg, /dev/dsk/c0t0d0s0,
the first mount filesystem)
0
PsiCopAuthor Commented:
OK, I think I have it. I'll scrap my original plan of putting root's home dir in /home and instead create /root on the root filesystem and do it there. I appreciate everyone's input.

Pointwise, I think a split between riaanvd and yuzh is appropriate. Other people contributed but I think those two gave the best Answers. If other folx disagree please say why and I'll reconsider.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.