Solved

Changing root's home directory

Posted on 2003-10-28
11
1,372 Views
Last Modified: 2013-12-27
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?
0
Comment
Question by:PsiCop
  • 3
  • 2
  • 2
  • +3
11 Comments
 
LVL 24

Expert Comment

by:shivsa
ID: 9634790
try chroot command.
0
 
LVL 34

Author Comment

by:PsiCop
ID: 9635237
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
 
LVL 24

Expert Comment

by:shivsa
ID: 9635314
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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 24

Expert Comment

by:shivsa
ID: 9635405
also after changing root dir, vipw will complain all the time, so use usermod command.
0
 
LVL 1

Accepted Solution

by:
riaanvd earned 125 total points
ID: 9635921
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
 
LVL 7

Expert Comment

by:glassd
ID: 9636920
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
 
LVL 48

Expert Comment

by:Tintin
ID: 9637233
I'll second glassd'd recommendation of making the homedir /root
0
 
LVL 1

Expert Comment

by:riaanvd
ID: 9637960
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
 
LVL 38

Assisted Solution

by:yuzh
yuzh earned 125 total points
ID: 9638197
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
 
LVL 38

Expert Comment

by:yuzh
ID: 9638211
PS: please remember to put the root's home under the /  filesystem (eg, /dev/dsk/c0t0d0s0,
the first mount filesystem)
0
 
LVL 34

Author Comment

by:PsiCop
ID: 9639159
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

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question