How to delete .htaccess via terminal (ubuntu)

5.3k Views Asked by At

I have a dedicated server and i cant delete, rename or move .htaccess file on my ftp.

How i can delete on terminal? my server is ubuntu and i have root access

The permission are set 644

I fixed using chattr -a .htaccess then i was able to delete, but i dont have idea what happen

2

There are 2 best solutions below

1
On

You can type the following command:

rm -rf file-name

on your terminal

0
On

You need to take a couple of steps. When server does not allow to erase .htaccess file on account folder, I logged in as root. So steps: Use commands

chattr -i .htaccess
chmod 777 .htaccess

Then you can delete that .htaccess file, the attributes of .htaccess has been changed so not even a root user can even modify, change attributes at all. The command chattr makes a file untouchable even if you are sudo root, owner, etc