权限问题,无法以root用户身份运行脚本 [英] Permission issues, not able to run script as root

查看:1461
本文介绍了权限问题,无法以root用户身份运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个Shell脚本(Script.sh),该脚本本身正在调用其他Shell脚本( Script2.sh,Script3.sh ...等).我以root用户身份登录,并已授予所有脚本执行权限.但是,当我执行"ls -l"时,脚本仍然没有文件属性列上显示的执行权限. "Script.sh"通过以下语法运行:

I am running a shell script(Script.sh) which, itself, is calling other shell scripts( Script2.sh, Script3.sh ...etc). I logged in as a root user and have given execution permission to all the scripts. But on when I execute "ls -l" the scripts still dont have execution permissions displayed on file attributes column. "Script.sh" runs by following syntax:

root@freescale $ sh Script.sh

但是此脚本无法执行由它调用的其他脚本(Script2.sh,Script3.sh).错误报告为权限被拒绝"

But this script is not able to execute other scripts(Script2.sh, Script3.sh) being called by it. Error is reported as "Permission denied"

我已经通过chmod命令授予了执行权限,但是权限也没有改变,脚本(Script2.sh,Script3.sh ..)也没有执行.

I already gave execution permission by chmod command but then also neither the permissions are changing nor the scripts(Script2.sh, Script3.sh ..) are executing.

我希望此错误是由于在Script3.sh中将Script2.sh调用为以下原因造成的:

I hope this error is due to the reason that Script2.sh are called in Script3.sh as:

./Script2.sh
./Script3.sh

如果我将其写为: sh Script2.sh 它执行但不能执行在Script2.sh内部调用的其他脚本,并报告与权限被拒绝"相同的错误

And if I write it as : sh Script2.sh It executes but doesn't able to execute other script which are called inside Script2.sh and reports same error as "Permission Denied"

推荐答案

请确保您的分区未通过noexec标志进行挂载(<顾名思义-防止制作任何文件"可执行文件)

Make sure that your partition is not mounted with the noexec flag (which - as the name suggests - prevents making any files executable)

这篇关于权限问题,无法以root用户身份运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆