Lompat ke konten Lompat ke sidebar Lompat ke footer

Linux Read-only File System Change to Write

Download Article

Download Article

If you desire to delete a file that has read-merely permissions in Linux, yous have a few options. If the file belongs to you, you can either alter the file's permissions or utilise the sudo control to delete the file equally root. Only if you're trying to delete a file that has write permissions and still tin can't delete information technology (or you meet a "Read Only File Organisation" error), yous may need to remount the drive with proper permissions. We'll show yous how to remove whatever read-only file on any Linux distribution, including Ubuntu and Linux Mint.

  1. 1

    Open a last window. If a file you own is read-but, you won't exist able to delete information technology unless you give yourself write permission for that file. If you're using a window manager, printing Ctrl + Alt + T to open a terminal window at present.

    • Use this method if you're trying to delete a file that belongs to you but (e.1000., y'all're the owner or in a group that has admission to read the file) but don't take permission to delete it.
    • If you're signed in remotely and already at a command prompt, only skip to the next footstep.
  2. 2

    Use cd to enter the directory of the file you lot desire to delete. For example, if the file you want to delete is inside a folder called documents in your domicile directory, you'd utilise cd documents or cd /habitation/username/documents.

    Advertising

  3. 3

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

  4. four

    Evaluate the permissions of the file you want to delete. The permissions for a file appear earlier its name like this: r--r--r--. The owner's name appears after it, followed by the grouping name.

    • r is read permissions, due west is write permissions, and 10 is execute permissions.
    • The first three characters in the permissions (in this example, r--), are the file owner's permissions. So, in this example, the owner of the file merely has read permissions, which means they tin can't write to, execute, or delete the file.
    • The 2d three characters are grouping permissions. If you're a member of a group and that group has write permissions to the file, you'll exist able to delete it even if you're not the owner.
    • The third three characters are world permissions, which is everyone else.
  5. 5

    Employ chmod -v u+rw filename to give yourself read and write permissions. You tin omit the r if you already have read permissions. Once you accept write permissions, y'all'll be able to delete the file.

    • If you lot're not the file owner but have root access to the system, you tin use sudo chmod -5 u+rw filename to give yourself the right permissions.
    • To see the file's new permissions, run ls -al over again.
  6. 6

    Use rm filename to delete the file. Now that you lot have write permissions on the file, deleting it will be simple.

    • If you aren't able to delete the file later on making it writable, its sectionalization may be mounted read-but. See Fixing the Read Only File Organization Mistake to troubleshoot.

    Advertisement

  1. one

    Open a final window. You can utilise the sudo control 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 final window at present.

    • Use this method if you are not the owner of the file you want to delete and yous'd rather only delete the file instead of first changing its permissions.
    • If y'all're signed in remotely and already at a command prompt, just skip to the next footstep.
  2. 2

    Use cd to enter the directory of the file you want to delete. For case, if the file you want to delete a file inside a binder chosen documents in your dwelling directory, you'd use cd documents or cd /habitation/username/documents.

  3. 3

    Use 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. four

    Use sudo rm filename to delete the file. You lot'll be prompted to enter your countersign to obtain root-level permissions. Once your password is accustomed, the read-only file volition be deleted.

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

    Advertizing

  1. i

    Open up a concluding window. If you're trying to delete a file and getting an error that says rm: cannot remove '(filename)' : Read but 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 manager.

    • If you lot're signed in remotely, just move to the adjacent step.
  2. 2

    Run df -h to view all mounted devices. You lot'll need to know the exact mountain point of the bulldoze that'south giving you problem. This displays all mounted drives.

  3. three

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

    • If you see ro in the results, the file system is read-just. Remounting the drive should gear up the fault. To do so, use mount -o remount,rw mount indicate . You can then delete the file.
    • If the permissions are rw, the disk is mounted with read-write permissions, which ways you should be able to delete files without problems. This usually means there's a problem with the file system on the bulldoze. Continue with this method.
    • If y'all come across remount-ro, this ways the in that location's a trouble with the file organisation and the drive was remounted as read-just to limit additional damage. This as well means there'south a trouble with the file system on the bulldoze. Continue with this method.
  4. 4

    If the permissions are correct, unmount the bulldoze. To do this, run sudo umount device . Supplant device with the device proper name, due east.g., /dev/sdd1.

    • Since you can't unmount a root file system, y'all tin can't check the file system of the root division unless you're booted into recovery mode. If the error is on the root file organization, boot into recovery way outset.
  5. 5

    Run sudo fsck -n device to bank check the bulldoze. This checks the integrity of the drive without making whatever changes. If the drive is okay, you'll see "clean" in the results. If there are errors, you will meet them.

    • If there are errors, support the bulldoze before yous keep in example the file system cannot be repaired.
  6. six

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

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

    Remount the drive one time repaired. If you were able to repair the errors, remounting the drive will make it so you tin can delete your files. Use mount -o remount,rw mountain point to ensure the bulldoze is remounted with read and write permissions. You should then exist able to alter and delete files on the drive.

    Advert

Enquire a Question

200 characters left

Include your email address to become a bulletin when this question is answered.

Submit

Advertizing

About This Article

Article Summary X

1. Use cd to enter the directory that contains the file.
ii. Use ls -al to view file owners and permission attributes.
3. Utilise chmod -five u+rw filename to give yourself read and write permissions.
4. Apply rm to delete the file.

Did this summary help you?

Cheers to all authors for creating a page that has been read 3,847 times.

Is this article up to date?

venturaartirles.blogspot.com

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

Posting Komentar untuk "Linux Read-only File System Change to Write"