linux让普通用户锁定在home家目录


建立伪shell

[root@localhost ~]# ln -s /bin/bash /bin/rbash
[root@localhost ~]# echo "/bin/rbash">>/etc/shells

添加你想限制的用户:
[root@localhost ~]# chsh -s /bin/rbash test
Changing shell for test.
Shell changed.

切换到test用户测试一下:
[root@localhost ~]# su - test
[test@localhost ~]$ cd /
-rbash: cd: restricted
[test@localhost ~]$ ls
[test@localhost ~]$ pwd
/home/test
[test@localhost ~]$ cd ..

-rbash: cd: restricted

QQ截图20131212114144.jpg


Whatever is worth doing is worth doing well.