LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1046|回复: 6

[急问]如何创建只能执行Ping命令的用户!!大家帮忙啊

[复制链接]
发表于 2006-9-5 11:50:35 | 显示全部楼层 |阅读模式
今天领导让我给业务员创建一个  主要是一个执行ping 命令的用户。 要求其他权限都没有


主要应用于 让业务员登陆到服务器 看看到对方主机的速度。:help :help :help


在线等待

要求业务员远程ssh登陆主机  锁定其根目录 ~

shell限制

除了下列
ls
cd
tracroute
tcptump
rm
telnet
ping
ps
top
vi
ssh
touch
mkdir

其余命令全部屏蔽掉。
发表于 2006-9-5 12:02:46 | 显示全部楼层
这么强啊?

编辑那个用户的.bashrc,
让它一旦登录就chroot到一个只后ping命令的环境下,不知道可行否?
回复 支持 反对

使用道具 举报

发表于 2006-9-5 12:07:40 | 显示全部楼层
把它的shell设置为rbash,单独设置路径,路径中只包含ping命令。
回复 支持 反对

使用道具 举报

发表于 2006-9-5 20:19:11 | 显示全部楼层
楼上说的听起来好像可行啊!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-6 00:09:40 | 显示全部楼层
服务器上没有rbash

怎么锁定这个用户不能出自己的目录啊?

jail  “牢笼”程序可以做到吗?

怎么设置啊 网上的方案好像行不通啊。

我的需求是:
要求远程ssh登陆主机  锁定其根目录 ~

shell限制

除了下列
ls
cd
tracroute
tcptump
rm
telnet
ping
ps
top
vi
ssh
touch
mkdir

其余命令全部屏蔽掉。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-6 11:03:55 | 显示全部楼层
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 or PATH variables.
Specifying command names containing slashes.
Specifying a filename containing a slash as an argument to the . builtin command.
Importing function definitions from the shell environment at startup.
Parsing the value of SHELLOPTS from the shell environment at startup.
Redirecting output using the `>', `>|', `<>', `>&', `&>', and `>>' redirection operators.
Using the exec builtin to replace the shell with another command.
Adding or deleting builtin commands with the `-f' and `-d' options to the enable builtin.
Specifying the `-p' option to the command builtin.
Turning off restricted mode with `set +r' or `set +o restricted'.
回复 支持 反对

使用道具 举报

发表于 2006-9-6 11:13:15 | 显示全部楼层
http://www.linuxsir.cn/bbs/showt ... amp;highlight=rbash

如果是nvi或vim在PATH中,用户可以通过它们运行其它本地命令,甚至是不受限制的shell。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表