Solved Type-errors in default shell directory of root

Hi,

Just 20 minutes ago I mistakenly typed an error directory address for root's default shell and exit. After I want to login as root again the command line feedback an error message

Code:
$ su
Password:
su: /bin/sht: No such file or directory

The path for sh shell should be /bin/sh but I mistakenly set it to /bin/sht, which was the original of the issue. Later, I could not access the root privilege because the default path was wrong and my default user did not have root privilege. After searching via bing.com for a little while, everybody said it should be fixed only by rebooting and entering the single user mode. However, after rebooting into single user mode, next issue came - I did not have write privilege of the / directory, as the / directory was read-only.

Someone said by this command the / directory would be turned to writeable,

Code:
# mount -u -w /

However, after running this command I got below message:

Code:
WARNING: R/W mount of / denied. Filesystem is not clean - run fsck
mount: : Operation not permitted

Finally, I got the fix but some searching:

Step 1, type and run:

Code:
fsck -tufs -y /dev/ada0p2

where ada0p2 is your hard drive where FreeBSD installed.

Step 2, type and run:

Code:
# mount -u -w /

After these two steps (under single user mode) the / directory should be turned into writeable from read-only mode and you should be able to use chsh command to correct the default shell path for root, by:

Code:
# chsh -s /bin/sh root

You could check the present default shell directory by:

Code:
# echo $SHELL

THE END
 
Yes, but that has nothing to do with root's shell. It's always set to /bin/csh regardless of what your user's shell is.
 
Back
Top