1

I installed Xubuntu a few days ago alongside my Windows10 and right now I am encountering a problem.

I am unable to rename, delete, or add a new file on my partitions. There is a lock icon on the files and it doesn't let me make any changes on that partition which I can easily do anything with them on Windows.

Is there a solution for removing the lock icon from all files on a partition and allowing me to make changes to them?

Dan
  • 13,119
CRYST4L
  • 21

3 Answers3

1

In contrary to Microsoft the maintainers of Linux had and have a very strong sense of security: Linux is a multi-user system even if most of us only have one user using is. It means documents need to be protected from users that are allowed on your system.

So Linux/Ubuntu works with permissions on disks, partition, directories and files and those permissions come in a set of 1 group of permissions for owner, 1 for a group and 1 for others and those also come in 3 parts: the ability to read, write and/or execute files. A lock icon means you do not own that location.

An example...

  • In case of a new installations partitions are owned by owner root and group root.

Start a terminal session as we mostly do this from command line: it is uniform and works on a lot of Unix-based systems.

1st: a partition needs to be mounted as writable before you can alter permissions.

This is what my partition (discworld) looks like after an initial install:

$ ls -ltr /
...
drwxr-xr-x  14 root root       4096 okt 25 18:40 discworld
...

This is what you do to own it:

$ cd /
$ sudo chown $USER:$USER discworld -R
$ ls -ltr /
...
drwxr-x---  14 rinzwind rinzwind       4096 okt 25 18:40 discworld
...

At the front you see the 3 sets for read, write and execute:

  • d for directory
  • rwx for the owner (1st rinzwind)
  • r-x for the group (2nd rinzwind)
  • --- for others

So the owner rinzwind can read, write and execute, the group rinzwind can read and execute, but not write, others can do nothing to my partition. Others is everyone not user root, not the owner, and not the users part of the group.

  • The rwx part is set with the chmod command but that is not really required for the answer to your question though needed for the concept of permissions. The owner is what creates the lock icon.

  • The $USER is a universal variable that holds your current user. For single user desktop it is the admin; if you need another user change it to the actual name.

  • -R means it is applied to all the content of the partition: all the files and directories in it get the same owner and group. Drop it if you ever need to apply it to a single item.

  • In the example I used a partition, but the same works for directories and files.

  • Be careful to ONLY do this with PERSONAL files. You can totally wreck your system with a single chmod or a single chown: the base system requires files to have specific permissions and owners and groups.

And this allows you to write, delete and read the contents, and it will remove the lock icon.

Rinzwind
  • 299,756
  • edit : no not working at all!! by changing my mount options the lock icons were removed but im not still the owner of partitions so icant do anything on them except copying their files i tried your way too but when i try this it shows on every file: ... chown: changing ownership of '/mnt/BAAA6CDDAA6C97A1': Read-only file system ... and when i type $ ls -ltr / it shows this : ... drwxr-xr-x 5 root root 4096 ... so the ownership is not changed any way. any idea on how to change its read-only file system mode? – CRYST4L Jan 06 '21 at 09:04
  • Where did I ever speak about mount options? "Read-only file system" you really need to mount it as writable. That comes before the ability to alter permissions on the partition itself. – Rinzwind Jan 06 '21 at 11:16
  • Take great care NOT changing any system directories or files - that will break your system (that is directories like /usr /etc /var /log and so on) The right way to access system files is to use sudoor similar ,,, NEVER change owner or access rights !!! – Soren A Jan 07 '21 at 14:32
0

So none of the solutions worked as i said im dual booting xubuntu with win10 and the win 10 makes this issue and its about mounting problems it makes so to fix this you just need to boot in your windows Right click on windows icon Open power options Then click on additional power setting At the left side open (choose what the power buttons do) Then click on change settings that are currently unavailable And finally simply turn off (fast startup) Windows doesnt correctly unmount your hard disk so it can boot faster next time thats why this issue occurres in linux when you boot up it makes your drive read only to prevent making more problems for the drive as it finds that your drive has problems and it cant mount correctly but when you turn off fast startup windows unmounts your drive completely and correctly so that problem wont happen Hope it helped!

CRYST4L
  • 21
0

I just ran into this problem myself, and here is the solution i came up with...

open folder with the locked files... snap it to the left side of the screen open terminal... type "sudo su"... enter your password... cd /path/to/your locked files... next type in nautilus and hit enter... snap that page to the right hand side and open up the one you have snapped to the left side... you will note the files on the left are locked but the files on the right are not... at this point you can (on the right page) right click files that are locked on the left side and click properties and then permissions then the drop down for the owner which will likely say root... scroll to where you see your username in the list and select it... the lock on the left page will vanish when you close the properties of that file... do this for each locked file...

surely from sudo su there is probably an easier way to change all ownerships within a folder or something like that, I figure that would be good information for someone just learning linux as I am (mostly trial and error)

Wizzdome
  • 99
  • 1
  • 1
  • Changing the ownership of system files and folder from "root" to another user may make the system unbootable. It is safer to open the files using sudo <name of the text editor> /path/to/file or by some other means such as by installing nautilus-admin. – user68186 Apr 10 '23 at 16:02
  • or you could just sudo nautilus and navigate from the root to wherever and just change properties? in my case i had a bunch of things i had just transfered and needed to rename. solution was to bring up the folder from root but still be able to see which files needed to be unlocked on the non root side... I dont mess about in the system... though you are right, they do warn you that unlocking a folder can cause system problems. idk about installing nautilus as admin as i have public access and want anything that has to be done password protected..Though I have always sought fixes through root – Wizzdome Apr 12 '23 at 04:28