I have tried to delete none active users from the server, when I ran:

/usr/sbin/userdel -r  

delete the user but not a home directory, and got this error:

cannot remove ‘olduser/.bash_history’: Operation not permitted

I have tried to remove manually as root:

rm -fR olduser    

I got the same not permitted. What else I can try to remove this user home directories?

  • Is the home directory an NFS-mounted file system? What does lsattr ~olduser/.bash_history say? – MadHatter Aug 15 '16 at 16:02
  • are you running commands as root? – alexus Aug 15 '16 at 16:05
  • not nfs mounted. lsattr output = -------------e-- .bash_history. yes I am running as root. – user559452 Aug 15 '16 at 16:23
  • what are the normal permissions with ls -la – xguru Aug 15 '16 at 17:03
  • also could you give the output from mount | grep "^/dev" – xguru Aug 15 '16 at 17:11

after few search. I did

  lsattr .bash_history

and return

----a-------e-- .bash_history

so, I have run

chattr -a

after that I am able to delete .bash_history

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.