Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-bash: chattr: command not found

Tags:

permissions

I am trying to change my .bash_profile and it spits back

error writing to .bash_profile Permission denied

So, I use the chattr -i .bash_profile to make it immutable and it gives me

-bash: chattr: command not found.

Can someone please help me on this?

like image 901
user1203225 Avatar asked Jan 17 '26 03:01

user1203225


2 Answers

If you use Ubuntu or Debian you can use

apt-get install e2fsprogs

Then you try again.

like image 130
Yuanmeng Xiao Avatar answered Jan 19 '26 18:01

Yuanmeng Xiao


Why do you assume, from that message, that the file is "immutable" and needs you to do a chattr -i?

You haven't given quite enough information to tell what the problem is, but my first thoughts are that 1) the file is not owned by you (created while su'ed or sudo'ed, perhaps), or 2) the permissions don't allow you to write to the file.

If you are indeed the owner (or can do a chown to make yourself the owner, assuming that's appropriate) try doing chmod u+w on it.

like image 22
jmarkel Avatar answered Jan 19 '26 19:01

jmarkel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!