[SOLVED] How to change from /sbin/sh to /bin/bash for 'root'?
Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
You can set root's default shell to bash:
Code:
usermod -s /bin/bash root
but that won't affect the shell used to run rc scripts which is /sbin/sh with Solaris 10 and older.
If you don't want to convert your script to the legacy bourne shell syntax, you can simply call it from the rc3.d one, eg:
@thomas2004ch
You'll need to be sure that /bin/bash is not a) stored in a filesystem separate from the root filesystem (/) b) not dynamically linked to a library that's in a separate filesystem from root (/). c) If the shell lives in a different filesystem, or requires libraries from a different filesystem, that filesystem needs to be accessible when the server drops to Single User Mode.
Check the Shell:
Quote:
On a Solaris 10 system of mine, there's no /bin. It's a link to /usr/bin.
So there's no "/bin/bash", it's really /usr/bin/bash (and that's the shell you should "usermod -s" with)
Code:
root@lhost# ll /bin/bash
-r-xr-xr-x 1 root bin 715K May 2 2007 /bin/bash*
root@lhost# ll /|grep bin | head -1
lrwxrwxrwx 1 root root 9 May 19 2010 bin -> ./usr/bin/
Now check the shell to make sure it's using libraries that don't traverse into a filesystem separate from root (/)
Now we just need to make sure that /lib and /usr are on the same filesystem as root (/)...
Code:
root@lhost# df -h .
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d10 10G 3.8G 6.5G 37% /
root@lhost# cd /lib ; df -h .
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d10 10G 3.8G 6.5G 37% /
root@lhost# cd /usr ; df -h .
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d10 10G 3.8G 6.5G 37% /
root@lhost#
Bear in mind that the dynamic libraries for this particular bash shell may be exclusive to Solaris 10 and/or it's level of patches. Here's what this system's at;
Code:
root@lhost# cat /etc/release
Solaris 10 10/08 s10s_u6wos_07b SPARC
Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 27 October 2008
root@lhost# uname -a
SunOS lhost 5.10 Generic_141414-07 sun4u sparc SUNW,Sun-Fire-V240
The above system is okay, because the root filesystem will always be mounted, and /usr and /lib are both within the root filesystem.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.