免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 1769 | 回复: 10
打印 上一主题 下一主题

Executable script without read permissions [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-09-06 15:04 |只看该作者 |倒序浏览
Hi all,

So far I am at a loss on whether this can be done or not.  Is there a way to make a script executable to others but not readable?  I created a script with perms rwx--x--x but others can not execute it. (Permission denied).  I tried setting perms to rws--x--x and that results in the same error.

I also created a world readable/executable script that simply called the rwx--x--x script and it also results in a permission denied error.

Strangely enough, a compiled c program with rwx--x--x will run fine for any user.  I know the shell is going through the fork() and exec()  calls and I believe since the file is not readable that may be the cause, but why would it work with a compiled app and not a shell script.  For curiosity sake, I tried to exec the script and still errors out.  I also tried using the ksh shell vice my bash shell and that made no difference.  Any ideas on how to let someone execute a script without being able to view its contents?

Thanks in advance.

PS.  I am using Linux.   I do not have access to my UNIX box to see if it is a UNIX vs Linux thing.  I don't believe it would be, but who knows.

论坛徽章:
0
2 [报告]
发表于 2004-09-06 15:11 |只看该作者

Executable script without read permissions


  1. 可能的话,还是用中文吧,ChinaUnix,呵呵
  2. 看着费劲
复制代码

论坛徽章:
0
3 [报告]
发表于 2004-09-06 15:27 |只看该作者

Executable script without read permissions

原帖由 "ivhb" 发表:
可能的话,还是用中文吧,ChinaUnix,呵呵
看着费劲


  
偶想炼一下用E文提问!

论坛徽章:
0
4 [报告]
发表于 2004-09-06 15:40 |只看该作者

Executable script without read permissions


  1. 对于您的为什么shell脚本非得给读权限才能执行呢? 当然给了读的权限,也就给了别人cp的权限(不考虑目录的限制).您会认为是一个很重要的安全问题.事实上,可以换个角度.如果不给对方读取的权限,就不知道执行的内容了么?至少通过两个方面可以知道.启动后,ps 监控,就能看到执行的内容;或许,根本不用这么麻烦的,set -vx足够了.
复制代码

论坛徽章:
0
5 [报告]
发表于 2004-09-06 15:49 |只看该作者

Executable script without read permissions

楼主也看英文讨论组,这个问题我前几天刚看过。但忘了在哪里了。

论坛徽章:
0
6 [报告]
发表于 2004-09-06 15:53 |只看该作者

Executable script without read permissions

script要被shell读取以后,解释执行的,不能读的话,script当然不能用了啦!

论坛徽章:
0
7 [报告]
发表于 2004-09-06 16:20 |只看该作者

Executable script without read permissions

if u really wanna hide something, wirte it in c and encrypt some critical sub-routines.

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
8 [报告]
发表于 2004-09-06 16:26 |只看该作者

Executable script without read permissions

simply no: you can't execute a shell script without read & execute permission.

please try to figure out the meaning of word 'script', then you may understand why you should READ it.

论坛徽章:
0
9 [报告]
发表于 2004-09-06 16:28 |只看该作者

Executable script without read permissions

if the srcipt can not be excuted with  rwx--x--x attribute, which may mean that those code in ur srcipt are only runnable at the shell.  try add "sh" before commands

论坛徽章:
0
10 [报告]
发表于 2004-09-06 16:34 |只看该作者

Executable script without read permissions

i cornfirm that what u described was true.

the reason:

for a script to run, bash (or other shells) need to read the source of the script to interpret it and print some screen outputs for u.  

if u have no read permission for the script, neither the bash process (owned by u).

a compiled c program does not need to read.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP