Originally posted by: 30JW_Bill_Harvey
Jumping all the way to chsh to change the login shell away from the restricted-shell (Rsh) seems quite excessive. I'm not admitting to ever having broken out of the Rsh jail, but, if I had, I think I'd only want to do that on very rare occasions... I think I'd be able to live quite happily 80% or 90% of the time inside the Rsh env, and only jump out on the very rare occasion when I wanted to explore the HMC setup in detail, or set up some scripted commands for my users... It's interesting to note that Rsh becomes completely impotent as soon as a writable directory is added to your $PATH... If you open Rsh, and run the following command:
# echo $(</proc/$$/cmdline)
you can see that the --rcfile that sets up the Rsh env is /opt/hsc/data/ssh/hmcsshrc
If anyone ever breaks out of Rsh (or cons IBM into granting a temp password), all you really need to do is add $HOME/bin to the PATH assignment in that file. Then copy your favorite shell into $HOME/bin, and you're $HOME/free... You have immediate access to an unrestricted shell any time you want it... You might find that you don't really need it as often as you think...
Still, without admitting that I ever have, if I were going to do that, I might limit unrestricted-shell access to root-holders. Changing the PATH assignment in /opt/hsc/data/ssh/hmcsshrc to something like:
if [[ -f /usr/local/etc/allow-bash/$USER ]]
then PATH=/hmcrbin/:/usr/hmcrbin:$HOME/bin
else PATH=/hmcrbin/:/usr/hmcrbin
fi
export PATH
and only populating /usr/local/etc/allow-bash/ with trusted users...
Or, even better, use a similar trigger to partition users into 3 categories: 1) root-users; 2) power-users; & 3) Rsh-users:
if [[ -f /usr/local/etc/allow-sbash/$USER ]]
then PATH=/hmcrbin/:/usr/hmcrbin:/usrlocal/sbin
elif [[ -f /usr/local/etc/allow-bash/$USER ]]
then PATH=/hmcrbin/:/usr/hmcrbin:/usrlocal/bin
else PATH=/hmcrbin/:/usr/hmcrbin
fi
export PATH
'course... if you don't want to go to all that trouble, you could simply:
# ln -s /bin/su /usr/hmcrbin
and you get a very similar result...
Disclaimer: If you act on any of the suggestions in this post, you're almost certainly violating your support agreement... However, I'd prefer to think of it as misdemeanor assault, rather than the violent battery of a chsh command...
All of that demands the question: Why IS IBM so dedicated to closing loopholes that allow escape from Rsh??? WHAT have they to hide such that trusted holders of root-password aren't allowed to logon as root???? Is there some flaw in the HMC environment that they have to hide by keeping everyone locked up? The mind boggles at the possibilities...
#AIX-Forum