Sponsored LinksКатегорииLinksUnix Tutorial
Personal Development Ruslan Valiev Solaris Performance Team Damien Farnham Fintan Ryan Nicky Veitch Niall Mullen Sean McGrath DTrace Bryan Cantrill Brendan Gregg ZFS Tim Foster General Ben Rockwood Learning Solaris 10 Privacy policy |
Wednesday, September 27. 2006Did you know: root shell in Solaris 10
As you know, traditionally with older Solaris versions you had to leave /sbin/sh as the default root shell. In Solaris 8 and 9, you're supposed to do this because all the libraries for dynamic linking are in /usr/lib, which could well be on a separate /usr filesystem. This filesystem may not be accessible during the maintenance boot, and therefore it is regarded as a very bad practice to change the root shell.
To make sure the superuser is always going to be able to log in, you have a /sbin/sh assigned to root, and it's a statically built binary, so it doesn't need any of the external libraries: bash-2.03$ file /sbin/sh /sbin/sh: ELF 32-bit MSB executable SPARC Version 1, statically linked, stripped bash-2.03$ ldd /sbin/sh ldd: /sbin/sh: file is not a dynamic executable or shared object But did you know, that Solaris 10 has greatly improved this situation for you, and there are two major improvements? Here they are: 1) Now standard libraries are in /lib, and therefore they're always accessible during your maintenance boots. As a result of this, your /sbin/sh shell is now a regular executable using dynamic libraries: bash-3.00$ file /sbin/sh /sbin/sh: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, stripped bash-3.00$ ldd /sbin/sh libgen.so.1 => /lib/libgen.so.1 libsecdb.so.1 => /lib/libsecdb.so.1 libc.so.1 => /lib/libc.so.1 libnsl.so.1 => /lib/libnsl.so.1 libcmd.so.1 => /lib/libcmd.so.1 libmp.so.2 => /lib/libmp.so.2 libmd5.so.1 => /lib/libmd5.so.1 libscf.so.1 => /lib/libscf.so.1 libdoor.so.1 => /lib/libdoor.so.1 libuutil.so.1 => /lib/libuutil.so.1 libm.so.2 => /lib/libm.so.2 /platform/SUNW,Ultra-5_10/lib/libc_psr.so.1 /platform/SUNW,Ultra-5_10/lib/libmd5_psr.so.1 2) Solaris 10 has a built-in protection against non-executable root shells. So, if you change it to any other shell and it for some reason cannot be started for you, you will automatically get a standard /sbin/sh instead. The same kind of protection exists for sudo command as well. These improvements make sure that there is nothing to stop you now from setting your root shell to anything you like. Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
насколько я помню ограничение на shell для root было еще и из-за того что многие скрипты для запуска демонов были на sh расчитаны и под другими шелами не тестировались/не работали
ну и в стандарте POSIX именно sh описан
Стыдно, конечно, признаваться, но меня стандарты POSIX недолго бы удержали от смены шелла ;)
Хотя я на самом деле и сейчас до сих пор /sbin/sh на root'е имею. Просто на тренинге вспомнилась эта тема, вот и решил написать заметку.
я как вспомню сколько мне серваков пришлось подымать после смены sh на bash... подымать сервисы которые стартовать и отрабатывать перестали...
я руту никогда shell не меняю...
Осторожность ещё никому не мешала ;)
Просто если когда-то в прошлом что-то не работало, а теперь подобные вещи исправлены - то почему бы и не попробовать? Это я не уговариваю, конечно, а в продолжение беседы говорю. Я сам - тоже не поменял нигде шеллов пока :)
у нас zsh везде :)
|





