Существует файл, который сделает это: /etc/login.defs
. Два значения Вы хотите надеяться изменяться здесь:
There's no way of preventing root from accessing the directory - within a Unix system root is omnipotent.
As to accidentally doing it.....it depends on what you are using to access the directory.
You might try....
export PS1="\u@\h [\$(check_path.sh)]>
Where check_path.sh is something like...
#!/bin/bash
if [ `whoami` = 'root' -a `pwd` = '/home/joe'] ; then
echo -n "!!!!!!accessing /home/joe as root !!!!!!!!!"
fi
You could write a script inside .bashrc
something like ... if [ command == "cd /home/joe" ] do ask done