I’m using Linux Mint “Tricia” 19.3 Cinnamon 64 bit ISO and use usb sticks to store folders and files. Using the sticks recently after I have entered files into the folders and then removed the stick from the computer. Next time I use the stick I can open it but a number of the folders/files are “locked” in read only. What causes this and how can I unlock the folders/files. I have this problem on a number of my usb sticks both new and old re-used ones…
Firstly, have you checked the permissions of the locked files using your file manager? It may be as simple as that, although I’m not sure how the permissions could have gone wrong.
Secondly, did you remember to unmount the devices before unplugging them? If you didn’t, then this can cause corruption. Usually this makes the whole device read-only, though — the idea behind that is to stop you making a bad thing worse. You can try to clean up any corruption with fsck.
First not sure how to check the permissions of the locked file can you explain how to do it.
Secondly I always unmount the usb sticks before unplugging them.
I’ll have a look at ‘fsck’ although being a novice in Linux I may find it difficult to fully understand how to use it.
Even if the file is locked one ought to be able to list the file permissions as follows: In a terminal, navigate to the directory containing your file and then:
ls -l filename
…substituting your file name, obviously! This will show you lots of info about your file. Please paste the output here.
To give you an idea of what to expect, here’s something from my PC:
keith@T500:~$ ls -l mail.txt
-rw-rw-r-- 1 keith keith 68 Apr 22 2020 mail.txt
keith@T500:~$
The bits in blue are the file permissions that we can change if necessary - and I’ll explain what they mean.
Nice to hear from you again, I’m feeling a bit foolish but I don’t know how to “In a terminal, navigate to the directory containing your file and then” I’ve tried various ways but have to ask the experts. I assume that I have to have the usb with the ‘locked’ files plugged in to be able to find the 'locked ’ files. So I’ve plugged one in and opened Terminal now how do I proceed from here?
My apologies - I ought to have read right from the start!
Ensure only one device in plugged into a USB port. Then enter
df | grep media
The “|” symbol is near the bottom left of your keyboard.
The text that appears look for /media/…etc…. Copy everything from /media to the end of that line (use Ctrl+Shift+c). Then change the directory to that one by:
cd <paste it here>
without the “<>” brackets. Paste using Ctrl+Shift+v
Then enter the command I mentioned earlier:
ls -l filename
…entering the appropriate file name. Please post all the output from these commands.
Got there in the end, kept mis-reading your instructions this is the result of your instructions :-
kevin@kevin-desktop:~$ df | grep media
/dev/sdb1 60456992 43655168 16801824 73% /media/kevin/PHILIPS UFD
kevin@kevin-desktop:~$ cd </media/kevin/PHILIPS UFD>/media/kevin/PHILIPS UFD ls -l
Now when I went back to check which filename to put into the end of last command, I noticed that all the “locked” folders had been “Unlocked” (no padlock icons) and was able to open the files as normal (not read only).
So Keith is this the result you were hoping for?
Spoke to soon, just rechecked my usb folders and files and noticed that the xls files and doc are still in “read only” format but not showing any ‘padlock’ icon but the ‘pdf’ and ‘photo’ files are okay.
So we are nearly there do I have to go through all the ‘read only’ files individually to resolve this?
Your command cd </media/kevin/PHILIPS UFD>/media/kevin/PHILIPS UFD ls -l
is not correct. You left the “<>” in!! and you didn’t press “Enter” after the “UFD”. The ls-l ought to be a new command on a new line.
In fact you have another problem: The USB name is in two parts with a space between them so we need to change things a bit.
Enter
cd "/media/kevin/PHILIPS UFD"
Note the inverted commas at start and end. AND PRESS the “Enter” key!!
Then
ls -l
This should list all the file names on your USB stick. Please list ALL the output including your user prompts.
That’s why I recommend the use of the GUI rather than the command line. You obviously can use that, as you say you saw a padlock on a folder or file. Right-click on the offending item and select the option Properties. There you can check the permissions and see who owns the file and what access is allowed.
You entered cd “/media/kevin/PHILIPS UFD” ls -l although I asked to to enter cd “/media/kevin/PHILIPS UFD” and then press the “Enter” key as the first command and then enter ls -l as a separate command. :
Here’s one of mine:
keith@T500:~$ df | grep media
/dev/sdb1 30259440 30960 30228480 1% /media/keith/TOSHIBA
keith@T500:~$ ls -l /media/keith/TOSHIBA
total 15792
-rw-r–r-- 1 keith keith 690907 Apr 19 2017 100_3814.JPG
-rw-r–r-- 1 keith keith 430200 Apr 9 2017 100_3889.JPG
-rw-r–r-- 1 keith keith 615019 Apr 18 2017 100_3915.JPG
-rw-r–r-- 1 keith keith 379723 Apr 30 2017 100_3962.JPG
keith@T500:~$ umount /media/keith/TOSHIBA
keith@T500:~$
Your inputting 2 commands at the same time you need to remove the apostrophes & the ls -l at the end
another problem could be the blank space between PHILIPS & UFD
copy & paste the following command at the command prompt
Just out of curiosity I created a folder and named it “Untitled Folder” and put it /home/Documents then in the terminal typed cd "~/Documents/Untitled Folder "
graeme@Garage-Office ~ $ cd “~/Documents/Untitled Folder”
bash: cd: ~/Documents/Untitled Folder: No such file or directory
then typed
cd ~/Documents/Untitled Folder
graeme@Garage-Office ~ $ cd ~/Documents/Untitled Folder
bash: cd: too many arguments
Then typed cd ~/Documents/Untitled\ Folder
graeme@Garage-Office ~ $ cd ~/Documents/Untitled\ Folder
graeme@Garage-Office ~/Documents/Untitled Folder $
I’m not saying you’re wrong Keith but it doesn’t seem to be working the way I’m doing it do you see anything I’m doing wrong ?
You are not doing anything wrong, Graeme.
cd “~/Documents/Untitled Folder” won’t work, as you say. But
cd ~/“Documents/Untitled Folder” does work.
cd ~/Documents/“new folder” also works.
Kevin is cd-ing from his home directory to /media so the ~/ is not necessary. e.g.
keith@T500:~$ df | grep media
/dev/sdb1 30259440 30960 30228480 1% /media/keith/TOSHIBA
keith@T500:~$ cd “/media/keith/TOSHIBA”
keith@T500:/media/keith/TOSHIBA$
Confused? Me too!
I don’t have a spare USB stick to rename badly so can’t test all this thoroughly.
Keith
Once again I thank you both for your help with my ‘locked’ files problem. What I should have told you earlier is I’m nearly 81 and whilst I’m reasonably comfortable using the computer I’m not up to speed with the terminology used in computers so If I’m not understanding correctly your instructions please bare with me.
I’ve not had chance to sit down and study your replies, I have to help out with domestic chores with my wife. I’m expecting a phone call from one of my sons this evening so if its okay with you both I’ll come back to tomorrow on this problem. I’m comfortable using the mouse for controls but willing to learn how to use Ctrl+shift etc. I note that whilst I’ve been away having tea that you have both been busy trying to resolve my problem, I need to have good look at them tomorrow to see if I can make understand better what you are both proposing I should do to resolve this problem.