Solved

Changing root's home directory

Posted on 2003-10-28
11
1,374 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AIX 6.1: need to grow single SAN disk rootvg, does this require a downtime? 11 59
Parsing a file using ksh 10 78
unix solaris snoop command 6 122
Solaris acount issues 44 46
Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

749 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