Linux 上的 Bash 权限被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48258274/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bash permission denied on Linux
提问by Henry
I was doing the "bof" problem on http://pwnable.kr/play.phpI downloaded the "bof" file. But when I use gdb, it says as follows:
我在http://pwnable.kr/play.php上做“bof”问题 我下载了“bof”文件。但是当我使用gdb时,它说如下:
Starting program: /home/henry/Downloads/bof
/bin/bash: /home/henry/Downloads/bof: Permission denied
/bin/bash: line 0: exec: /home/henry/Downloads/bof: cannot execute: Permission denied
During startup program exited with code 126.
bof.c:
bof.c:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void func(int key){
char overflowme[32];
printf("overflow me : ");
gets(overflowme); // smash me!
if(key == 0xcafebabe){
system("/bin/sh");
}
else{
printf("Nah..\n");
}
}
int main(int argc, char* argv[]){
func(0xdeadbeef);
return 0;
}
回答by Utkarsh
It's the issue with your permissions. You currently don't have the permissions to execute the bof file.
这是你的权限问题。您当前没有执行 bof 文件的权限。
To fix this, open the terminal and use the chmod
command.
要解决此问题,请打开终端并使用该chmod
命令。
chmod +x /home/henry/Downloads/bof
This will give you the permission to execute the file. You can also use something like chmod 744 /path/to/file
as an alternative. This will give you the permission to read, write, and execute on your account.
这将授予您执行文件的权限。您也可以使用类似的东西chmod 744 /path/to/file
作为替代。这将授予您在您的帐户上读取、写入和执行的权限。
Check out linode documentation to know about file permissions.
查看 linode 文档以了解文件权限。