Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it ok for me to copy /sbin/sh to 1

Status
Not open for further replies.

slymac

IS-IT--Management
Sep 20, 2001
36
CA
Is it ok for me to copy /sbin/sh to /usr/bin/sh???
I just did it and it works... are there any differences between the two files??

Thanks
 
On the face of it, the only differences appear to be

-r-xr-xr-x 3 bin root 88620 Jul 16 1997 /usr/bin/sh
-r-xr-xr-x 2 bin root 251712 Jul 16 1997 /sbin/sh

and

/sbin/sh: ELF 32-bit MSB executable SPARC Version 1, statically linked, stripped
/usr/bin/sh: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, stripped

Greg.
 
/sbin contains statically linked binaries, that is - they have been built containing all external functions and routines that they need so are ready to go and independent of the libraries. The /usr/bin executables on the other hand are dynamically linked, that is, they will gather any external functions/routines that they need at runtime. As an example, consider root's standard shell as seen in /etc/passwd, which is /sbin/sh. If you had a problem with shared libraries and were using /usr/bin/sh instead of /sbin/sh as the standard shell for root, then it is possible that you would not be able to run a root shell (and fix the problem). /sbin/sh (the statically linked one) still runs, even if there is a problem with the libraries, because it already has everything it needs. Consequently, the /sbin binaries are larger than the /usr/bin binaries. In Solaris 8 /sbin/sh is approx 275K whereas /usr/bin/sh is approx 95K. Downside of statically linked programs though is that they would need to be recompiled if the libraries change, the dynamically linked files wouldn't because they access the libraries at runtime.

The description above is also a good reason for not changing the standard shell for the user root.

(NB: I cribbed this from - I'm not that clever ;-))
One by one, the penguins steal my sanity.
 
Hey, clever enough to know where to look!!! And that's half the battle :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top