Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to Change root's Home

Ralph Grothe
Honored Contributor

Failed to Change root's Home

Hi,

this should be an easy one.

I don't want the root directory i.e. / to be the root account's home.

Thus I created a directory /root which resides in the same filesystem as the root LV (i.e. no submount).

When I issue usermod this happens:

# ls -ld /root
drwx------ 2 root sys 96 Jul 11 15:30 /root
# awk -F: '$3==0 {print $(NF-1)}' /etc/passwd
/
# useradd -D
GROUPID 20
BASEDIR /home
SKEL /etc/skel
SHELL /sbin/sh
INACTIVE -1
EXPIRE
# usermod -d /root root
'/root' is not a valid directory

Is this only changeable for the root account in single user mode?
Or could I use the "vipw" command and edit the home field directly?

Finally, the mount of the Root FS looks strange:

# bdf /
Filesystem kbytes used avail %used Mounted on
/dev/root 143360 31507 104874 23% /
# grep ' / ' /etc/fstab
/dev/vg00/lvol3 / vxfs delaylog 0 1
# lvlnboot -v|grep -i root
Physical Volumes belonging in Root Volume Group:
Root: lvol3 on: /dev/dsk/c1t2d0
# grep ' / ' /etc/mnttab
/dev/root / vxfs log 0 0 994940210

Why didn't init mount the /dev/vg00/lvol3 instead of /dev/root.
The latter looks quite strange to me.

Regards
Ralph
Madness, thy name is system administration
6 REPLIES
Laurent Paumier
Trusted Contributor

Re: Failed to Change root's Home

You just need to change this in /etc/passwd using vipw. Find the line for root and change the 6th field from / to /root. Move all config files to the new dir (mv /.??* /root/) and you're done.
Oliver Stoklossa
Frequent Advisor

Re: Failed to Change root's Home

Hi Ralph ...

vipw works fine ... just change / to /root, but check the permissions. Why don't you just use SAM to change the home-directory ... you can't change the login name nor UID, but the homedir is no prob ...

Cheers

Oli
Patrick Wallek
Honored Contributor

Re: Failed to Change root's Home

Last error first:

To get / mounted correctly:

mv /etc/mnttab /etc/mnttab.old
mount -a

This will not affect any of your mounted file system, but will correct the error.

Changeing root's homedir: I'd just use vipw and change the directory to /root. One thing I would consider though is that one of the reasons for changeing roots homedir is so you don't fill up / inadvertently. I would consider putting root's homedir as /home/root. That way if you do something silly and create a huge file, you fill up /home, but not /. Filling home may not be good, but I'd rather it be /home at 100% than /.
Laurent Paumier
Trusted Contributor

Re: Failed to Change root's Home

Oops, forgot the second part of your question... The root fs is mounted directly by the kernel, the line in /etc/fstab is not used (/etc/fstab does not even exist until / is mounted...). Thus the symbolic name /dev/root instead of /dev/vg00/lvol3.
Robin Wakefield
Honored Contributor

Re: Failed to Change root's Home

/dev/root is a pseudo failsafe device. To fix:

rm /etc/mnttab
mount

mount with no args rebuilds mnttab.

Robin.
Ralph Grothe
Honored Contributor

Re: Failed to Change root's Home

Many thanks for your hints to all.

Sorry, for the mispost in databases.
I meant to post this in administration but there must have been some stale hidden field still lingering when I hit the submit button.

Actually, I knew that as root I would always be able to make changes to /etc/passwd but usually there's more involved behind the scenes than just changing one field.
That's why I prefer to run the usermod command on SysV Unices.
For instance on Solaris or Linux with an /etc/shadow you would also have to issue a pwconv.
But since we don't run a secure system in that respect a mere vipw will probably do the job.

With regard to my strange / mount.
Patrick, I clobbered the mount table
(i.e. >/etc/mnttab), and ran a mount, which rebuilt it, but exactly same as before.
Even a temporary renaming didn't help.
Will I have to reboot (or change runlevel) first in order to get it fixed?
Because I'm not familiar with the /dev/root device I have a sneaking suspicion that my mirrored /dev/vg00/lvol3 may not be kept in sync as long as it doesn't appear in /etc/mnttab.
I hope I'm wrong in this respect.
Madness, thy name is system administration