怎样限制系统用户在自家目录里?

由 super_1130 在 12-31-2003 11:16 发表:

怎样限制系统用户在自家目录里?

假设有个系统用户guest;/home/guest

我向限制guest用户telnet上来之后,只能在/home/guest内活动,不能访问系统的其他资源!大哥们帮帮小弟!


由 bwb 在 12-31-2003 13:10 发表:


除非改成认证的用户,比如带认证的FTP用户,否则好象不能。


林子大了,什么鸟都有...


由 Snoopy 在 12-31-2003 15:58 发表:


几乎所有的ftp软件都可以那样控制,telnet和ssh这就不懂了


And then in the evening light, when the bars of freedom fall

I watch the two of you in the shadows on the wall

How in the darkness steals some of the choices from my hand

Then will I begin to under


由 folklore 在 01-01-2004 11:42 发表:


我也想知道;

....

有了,

用alias命令!

你可以设一个shell script

来断定用户是否在它的目录下:

mycd.bash:

.................

然后更改cd命令:

#chmod 755 $mycd_path/mycd

在用户的.bash_profile中加入以下一句:

alias cd $mycd_path/mycd

最后,更改.bash_profile的用户属主和权限:

#chown root .bash_profile

#chmod rwsr-xr-x .bash_profile

————————————————————

ok

为了防止用户改回它的cd

加入下面一句

alias alias "echo 'Error:you can not use alias.'"


Gamma Fork

----------------------------------------

Then am I

A happy fly

If I live

OR if I die


由 Glue 在 01-01-2004 23:47 发表:


正确的方法应该是用restricted shell

http://www.faqs.org/docs/bashman/bashref_75.html

6.10 The Restricted Shell

If Bash is started with the name rbash, or the `--restricted' option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. A restricted shell behaves identically to bash with the exception that the following are disallowed:

  • Changing directories with the cd builtin.

  • Setting or unsetting the values of the SHELL, PATH, ENV, or BASH_ENV variables.

  • Specifying command names containing slashes.

  • Specifying a filename containing a slash as

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus