LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Can't Modify .bashrc as root (https://www.linuxquestions.org/questions/linux-general-1/cant-modify-bashrc-as-root-717434/)

Ukuntu 04-07-2009 09:27 AM

Can't Modify .bashrc as root
 
On one of my client's servers I attempted to modify ~/.bashrc as root to add in some aliases and update $PATH

Well on this particular system, for some reason all the /root SSH profile files are read only and I cannot modify. When I open them in VI it says read only and :w! fails.

I checked and the user:group is root:root and the permissions are 0644. I attempted to chmod it to 777 and I got permission denied.

Anyone have any clue?

Robhogg 04-07-2009 09:54 AM

What are the results of:

Code:

lsattr .bashrc
?

If the output contains an i like in "----i-------------- .bashrc" then the "immutable" bit is set, which prevents any changes being made. If so, execute:

Code:

chattr -i .bashrc
You will need to be root, or use sudo, to do this.

Edited to add: you could also try getfacl .bashrc to check whether an access control list has been set.

Ukuntu 04-07-2009 09:58 AM

Quote:

Originally Posted by Robhogg (Post 3501243)
What are the results of:

Code:

lsattr .bashrc
?

If the output contains an i like in "----i-------------- .bashrc" then the "immutable" bit is set, which prevents any changes being made. If so, execute:

Code:

chattr -i .bashrc
You will need to be root, or use sudo, to do this.

That worked. Thank you very much. :)


All times are GMT -5. The time now is 05:00 PM.