error: /usr/include/stdio.h: Permission denied 的一种情况分析

代码:

  1. #include <stdio.h>
  2. int main(){
  3. printf ("hello long size %d\n",sizeof(long));
  4. }

很简单,测试是否能够编译通过
对比

  • 在root的用户下编译正常通过
  • 在其他用户测试不通过

    点击(此处)折叠或打开

    1. ~> gcc test.c
    2. test.c:1:19: error: /usr/include/stdio.h: Permission denied
    3. test.c: In function 'main':
    4. test.c:5: warning: incompatible implicit declaration of built-in function 'printf'

尝试着解决问题

提示说是权限受限。
在root用户下看看stdio.h的属性

点击(此处)折叠或打开

  1. ll /usr/include/stdio.h
  2. -rw-r--r-- 1 root root 31144 2010-05-06 10:33 /usr/include/stdio.h

具有可读属性,但是用vim打开,显示是个 [new file], 为什么呢?
具有可读权限就是看不到文件!

给文档添加可执行权限,chmod +x /usr/include/stdio.h
问题如故

给link添加可执行权限,# find /usr/include/ -type l -exec ls -l {} \;
问题如故

去除link的可执行权限,# find /usr/include/ -type l -exec chmod -x  {} \;

给文件夹添加可执行权限,# find /usr/include/ -type d -exec chmod +x  {} \;
问题解决

分析
    我不明白,打开/usr/include/stdio.h 和其他文件夹的可执行权限有什么相关,因为/usr/include和/usr/include/stdio.h 都具有可行性,用户应该可以读取stdio.h文件才对啊。
   
这个情况出现在移植的过程中,为了防止不必要的麻烦,添加如下命令,chmod -R 755 /usr/include/

error: /usr/include/stdio.h: Permission denied 的一种情况分析的更多相关文章

  1. error: /usr/include/objc/objc-class.h: No such file or directory

    When i use the example of ShareKit package,i have come across this error:"error: /usr/include/o ...

  2. #include <stdio.h>

    1 fflush 2 fgetc 3 fgets 4 fprintf 5 fputc 6 fputs 7 fscanf 8 fseek 9 ftell 10 perror 11 remove 12 r ...

  3. 第二次作业#include <stdio.h> int main() { int a,b,c,d,e; printf("请输入一个不多于五位的整数:\n"); scanf("%d",&a); if(a>=100000||a<=0) { printf("输入格式错误! \n"); } else { if(

    1 判断成绩等级 给定一百分制成绩,要求输出成绩的等级.90以上为A,80-89为B,70-79为C,60-69为D,60分以下为E,输入大于100或小于0时输出"输入数据错误". ...

  4. git报错 error: cannot stat ‘'web/js': Permission denied

    切换分支时报错: error: cannot stat ‘'web/js': Permission denied 解决方法:退出编辑器.浏览器.资源管理器等,然后再切换就可以了.

  5. c语言输入与输出库函数#include<stdio.h>

    last modified: 2010-05-28 输入与输出<stdio.h> 头文件<stdio.h>定义了用于输入和输出的函数.类型和宏.最重要的类型是用于声明文件指针的 ...

  6. [pod install] error: cannot open .git/FETCH_HEAD: Permission denied

    pod installAnalyzing dependencies[!] Pod::Executable pull error: cannot open .git/FETCH_HEAD: Permis ...

  7. #include<stdio.h> #include "stdio.h"

    https://baike.baidu.com/item/#include <stdio.h> #include <stdio.h> 编辑 #include<stdio. ...

  8. #include stdio.h(B)

    #include <stdio.h> int main() { //***********一.循环语句*************** //什么叫做循环: //重复的做某件事情,重复的执行一 ...

  9. #include stdio.h(A)

    /* 第一个*******知识点工程相关信息******** 1.创建工程 文件->新建->工程->win32 console applecation ->文件名不能为汉字 2 ...

随机推荐

  1. ACM比赛(11462 Age Sort)

    You are given the ages (in years) of all people of a country with at least 1 year of age. You know t ...

  2. 在Vista以上版本运行WTL程序,有时候会提示“这个程序可能安装补正确...”的错误

    在Win7/Vista下,如何以兼容模式运行exe?     https://msdn.microsoft.com/en-us/library/dd371711(VS.85).aspx     问题描 ...

  3. [转]tripwire-文件指纹

    原文链接:http://www.ipython.me/centos/tripwire-file-md5.html Tripwire是目前最为著名的unix下文件系统完整性检查的软件工具,这一软件采用的 ...

  4. 使用linq对字符串1,2,3,4,5,6,7,8,9,10求和

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SumI ...

  5. JS图片上传后base64转码

    代码: // 获取文件流 var fileObj = document.getElementById('inputId').files; // 实例化一个FileReader对象 var reader ...

  6. 类作为返回类型 ,具有java特点-封装等 而且应用起来很方便。

    public class StudentDao { public Student getStudent(){ Student stu = new Student(); stu.setName(&quo ...

  7. boost uuid

    uuid: uuid库是一个小的使用工具,可以表示和生成UUID UUID是University Unique Identifier的缩写,它是一个128位的数字(16字节),不需要有一个中央认证机构 ...

  8. hihoCoder 1014trie树(字典树)

    hihoCoder 1014 题目提示已经很清楚了~ 贴代码…… #include <iostream> #include <cstdio> #include <cstr ...

  9. Buenos Aires和Rio de Janeiro怎么发音?

    Buenos Aires和Rio de Janeiro怎么发音?_百度知道     Buenos Aires和Rio de Janeiro怎么发音?    2009-09-25 08:58 zd029 ...

  10. pygame编写贪吃蛇

    一直想用pygame做一个小游戏的,可是因为拖延症的缘故一直没有动,结果那天看到了一个12岁的国际友人小盆友用pygame做的一款塔防游戏,突然感觉已经落后超级远了,所以心血来潮做小游戏了.高中陪伴我 ...