I am using /bin/rbash
for some users. It's working as expected but there is some hack like when users run bash
or dash
, then they got unrestricted shells, so to avoid these commands, I have added below functions in their .bashrc
files.
bash() {
echo "WARNING: NOT ALLOW!!"
}
sh() {
echo "WARNING: NOT ALLOW!!"
}
So my question is:
1# can we use functions with multiple names as below
func1,func2 () {
# do stuff
}
2# I also tried:
case $BASH_COMMAND in # check each command`
bash|dash|sh)
echo "WARNING: NOT ALLOW!!"
;;
esac
3# /bin/rbash -> bash
it's just a soft link of bash, then how does it work as restricted?
Also there is some command to avoid users to execute that like unset HISTFILE
and kill -9 $$
Is there any alternate way to achieve the same?