It's that simple:
root@server [/etc]# touch /etc/bashrc
touch: cannot touch '/etc/bashrc': Permission denied
OS: Linux
Distro: CentOS
Release: 5.3
Extras: cPanel installed
Any ideas?
It's that simple:
root@server [/etc]# touch /etc/bashrc
touch: cannot touch '/etc/bashrc': Permission denied
OS: Linux
Distro: CentOS
Release: 5.3
Extras: cPanel installed
Any ideas?
Check if you have i
attribute on the file:
# lsattr /etc/bashrc
----i------------e- /etc/bashrc
If yes, remove it:
# chattr -i /etc/bashrc
1) ls -l /etc/bashrc will show you attributes of the file, maybe its read-only even for root ?
2) Or it could be SELinux that prevents you from "writing" to the file.
The file could be also immutable. That would be odd. This is a sign of something wrong or pretty unusual.
See the solution.
Finally I got the solution. Its the SELinux mode issue. First I check current SELinux mode.
getenforce Here is: Enforcing So it needs to be Permissive.
setenforce [Enforcing|Permissive|1|0] To make changes persistent through a system reboot, edit the 'SELINUX=' line in /etc/selinux/config for either 'enforcing', 'permissive', or 'disabled'. For example: 'SELINUX=permissive'