Skip to content Skip to sidebar Skip to footer

Fix Your Permissions and Remove Read Only

Download Article

Download Article

If you want to delete a file that has read-simply permissions in Linux, you have a few options. If the file belongs to you, you lot can either modify the file'southward permissions or use the sudo command to delete the file equally root. But if you lot're trying to delete a file that has write permissions and still tin't delete it (or you see a "Read Only File Arrangement" error), you may need to remount the bulldoze with proper permissions. We'll bear witness you how to remove any read-only file on whatsoever Linux distribution, including Ubuntu and Linux Mint.

  1. one

    Open a last window. If a file you own is read-but, you lot won't be able to delete it unless y'all give yourself write permission for that file. If y'all're using a window manager, press Ctrl + Alt + T to open a terminal window at present.

    • Utilise this method if yous're trying to delete a file that belongs to you merely (east.one thousand., you're the owner or in a grouping that has access to read the file) only don't take permission to delete it.
    • If you're signed in remotely and already at a command prompt, but skip to the next step.
  2. 2

    Use cd to enter the directory of the file you lot want to delete. For example, if the file you want to delete is inside a binder called documents in your abode directory, yous'd utilize cd documents or cd /abode/username/documents.

    Advertisement

  3. 3

    Use ls -al to display the file permissions for the files in the directory. Using ls -l displays a list of files in the directory, along with the possessor of each file and its permissions. Adding the a to ls -l also shows hidden files and folders in the directory.

  4. 4

    Evaluate the permissions of the file yous want to delete. The permissions for a file announced earlier its name like this: r--r--r--. The owner's name appears later it, followed by the grouping proper noun.

    • r is read permissions, w is write permissions, and 10 is execute permissions.
    • The commencement iii characters in the permissions (in this example, r--), are the file owner'southward permissions. So, in this example, the owner of the file only has read permissions, which means they tin can't write to, execute, or delete the file.
    • The second three characters are group permissions. If you're a member of a group and that group has write permissions to the file, you'll be able to delete information technology even if you're not the owner.
    • The tertiary three characters are earth permissions, which is everyone else.
  5. v

    Use chmod -five u+rw filename to requite yourself read and write permissions. Y'all can omit the r if you already have read permissions. In one case you accept write permissions, you'll be able to delete the file.

    • If you're not the file possessor but have root access to the organisation, you tin use sudo chmod -v u+rw filename to give yourself the right permissions.
    • To see the file'due south new permissions, run ls -al again.
  6. 6

    Use rm filename to delete the file. Now that y'all have write permissions on the file, deleting it volition be simple.

    • If you aren't able to delete the file afterward making information technology writable, its division may exist mounted read-only. Come across Fixing the Read Only File System Error to troubleshoot.

    Advertisement

  1. 1

    Open up a final window. You can use the sudo command to delete a read-only file that you aren't able to delete with your user account. If you lot're using a window manager, press Ctrl + Alt + T to open a last window at present.

    • Utilize this method if you are non the owner of the file you want to delete and you'd rather merely delete the file instead of first changing its permissions.
    • If you're signed in remotely and already at a command prompt, just skip to the next step.
  2. two

    Use cd to enter the directory of the file yous want to delete. For example, if the file you want to delete a file inside a folder called documents in your home directory, you lot'd utilize cd documents or cd /home/username/documents.

  3. 3

    Apply ls -al to view the contents of the directory. This command will display all of the files in the current directory, as well as each file'due south owner and permissions.

  4. iv

    Use sudo rm filename to delete the file. Y'all'll exist prompted to enter your password to obtain root-level permissions. In one case your countersign is accustomed, the read-only file will be deleted.

    • If you aren't able to delete the file with sudo, its division may be mounted read-but. See Fixing the Read Only File Organisation Error to troubleshoot.

    Ad

  1. 1

    Open a last window. If you're trying to delete a file and getting an error that says rm: cannot remove '(filename)' : Read only file system, there are a few possible causes. Start past pressing Ctrl + Alt + T to open a terminal window if you're using a window director.

    • If you're signed in remotely, only motility to the side by side step.
  2. 2

    Run df -h to view all mounted devices. Yous'll need to know the exact mountain bespeak of the drive that's giving you lot problem. This displays all mounted drives.

  3. 3

    Run the command mount . Replace mount bespeak with the actual mount signal, e.g., /media/usbdisk. If you're trying to delete a file on a removable deejay or network drive, such as an old backup, the disk where the file is stored might exist mounted as read-only.

    • If yous encounter ro in the results, the file system is read-just. Remounting the drive should fix the error. To do and so, use mount -o remount,rw mount signal . You can so delete the file.
    • If the permissions are rw, the disk is mounted with read-write permissions, which means you should exist able to delete files without problems. This usually means there'south a problem with the file system on the drive. Go on with this method.
    • If you lot see remount-ro, this ways the there's a problem with the file organisation and the drive was remounted as read-simply to limit boosted impairment. This as well means there's a problem with the file system on the bulldoze. Continue with this method.
  4. 4

    If the permissions are correct, unmount the drive. To practise this, run sudo umount device . Replace device with the device name, e.g., /dev/sdd1.

    • Since you tin't unmount a root file system, you can't check the file system of the root sectionalisation unless you're booted into recovery mode. If the mistake is on the root file organisation, kick into recovery manner starting time.
  5. v

    Run sudo fsck -northward device to check the bulldoze. This checks the integrity of the bulldoze without making any changes. If the drive is okay, yous'll come across "clean" in the results. If in that location are errors, you volition see them.

    • If there are errors, back up the bulldoze before y'all continue in case the file arrangement cannot exist repaired.
  6. 6

    Run sudo fsck device to repair errors. If at that place are errors, you lot'll exist prompted to right them.

    • Even if yous are able to correct errors, brand a backup just in case the drive is dying.
  7. 7

    Remount the drive once repaired. If yous were able to repair the errors, remounting the drive will make information technology then y'all can delete your files. Use mount -o remount,rw mountain bespeak to ensure the bulldoze is remounted with read and write permissions. You should and then exist able to change and delete files on the drive.

    Advertisement

Ask a Question

200 characters left

Include your e-mail address to get a bulletin when this question is answered.

Submit

Advertisement

About This Article

Article Summary X

one. Employ cd to enter the directory that contains the file.
2. Employ ls -al to view file owners and permission attributes.
3. Employ chmod -5 u+rw filename to give yourself read and write permissions.
4. Apply rm to delete the file.

Did this summary help you?

Thanks to all authors for creating a folio that has been read iv,337 times.

Is this commodity up to date?

leonbeephock.blogspot.com

Source: https://www.wikihow.com/Delete-Read-Only-Files-in-Linux

Post a Comment for "Fix Your Permissions and Remove Read Only"