文档

Linux系统中修改系统文件“/etc/profile”时提示“Permission denied”错误

更新时间:

问题描述

在Linux系统中修改系统文件/etc/profile时提示“Permission denied”错误,查看root用户权限,确认拥有读取和写入的权限。

问题原因

存在第三方模块。

解决方案

  1. 登录服务器,执行如下命令,查看文件隐藏属性
    lsattr /etc/prof* 
    
  2. 执行如下命令, 获取目录和文件的访问控制列表。
    getfacl /etc/prof*
    
  3. 执行如下命令,查看目录的详细信息。
    ll /etc/prof*
    
    系统返回类似如下。
    -rw-r--r--. 1 root root 1796 Oct  2  2013 /etc/profile
    -rw-r--r--  1 root root 1796 May 17  2017 /etc/profile~
    -rw-r--r--  1 root root 1796 Oct  2  2013 /etc/profile_bak
    -rw-r--r--  1 root root 1796 Apr  3 15:56 /etc/profill~
    -rw-r--r--  1 root root 1796 Apr  3 15:50 /etc/profilm~
    -rw-r--r--  1 root root 1796 Apr  3 15:29 /etc/profiln~
    -rw-r--r--  1 root root 1796 Apr  3 15:10 /etc/profilo~
    -rw-r--r--  1 root root 1796 Apr  3 13:37 /etc/profilp~
    -rw-r--r--  1 root root 1796 Apr  3 13:32 /etc/profilq~
    -rw-r--r--  1 root root 1796 Apr  3 13:25 /etc/profilr~
    -rw-r--r--  1 root root 1796 Apr  3 13:21 /etc/profils~
    -rw-r--r--  1 root root 1796 Apr  3 13:21 /etc/profilt~
    -rw-r--r--  1 root root 1796 Apr  3 13:19 /etc/profilu~
    -rw-r--r--  1 root root 1796 Apr  3 13:19 /etc/profilv~
    -rw-r--r--  1 root root 1796 Apr  3 13:19 /etc/profilw~
    -rw-r--r--  1 root root 1796 Feb 28 12:40 /etc/profilx~
    -rw-r--r--  1 root root 1796 Feb 28 12:40 /etc/profily~
    -rw-r--r--  1 root root 1796 May 17  2017 /etc/profilz~
    
  4. 进入/etc/init.d/目录,执行如下命令。
    ls
    
    系统返回类似如下,存在第三方模块,可以将yunsuo模块设置为禁止启动,或者卸载yunsuo模块,重启实例后,即状态恢复正常。

适用于

  • 云服务器 ECS
  • 本页导读 (1)
文档反馈