Files after Linux installation
December 29, 2021 11:23 AM   Subscribe

I installed a new Linux OS. My files were saved, but they were set Read Only and I don't have permission to change them. How do I get my files back?

I'm not tech savvy, so bear with me. I have a computer running Linux. A while ago, the OS that was on the computer when I bought it stopped being supported. A friend downloaded and installed a new Linux OS for me. I know enough that I put the files I absolutely wanted and needed on a thumb drive for safe keeping and crossed my fingers.

The new OS was installed and my files weren't deleted, hurray. The problem is that the installation put my files on a separate drive/separate device/something I don't really understand. And the files were set Read Only and I don't have permission to change their settings. I can access the files and resave them over in My Documents. But I don't want to end up having two sets of files on my computer. My account is the only account on the computer. So I'm at a loss on how I can get back control of my files.
posted by Stuka to Computers & Internet (14 answers total)
cd to the directory
sudo chmod -R 777 *
Anything in that heirarchy should be accessible to anyone.
posted by sydnius at 11:47 AM on December 29, 2021

Are you sure that your files were set read only, and not that the drive was set as read only?

"cd" to the location of the files, and type "df ." . There will be 2 lines returned: similar to:
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/debian-home  1.8T  1.1T  633G  63% /home
From there, you would want to make note of the /dev/mapper/debian-home (or whatever it is for your instance). We'll call it $FilePath.

Now type: "mount | grep $FilePath" (continuing my above case it would be: "mount | grep /dev/mapper/debian-home" )

And you'll get something like:
/dev/mapper/debian-home on /home type ext4 (rw,relatime)
If the part in parenthesis is "ro" that's why you have the problem. To make the files editable, you could possibly just do, "mount -o remount $FilePath" . But potentially your linux distro just came with the older ntfs module that only could mount as read only, in which case I'll point you to: .
posted by nobeagle at 12:03 PM on December 29, 2021 [2 favorites]

Okay, a few questions if I may.

What OS was originally on the computer/what OS were you using to create the files?

I suspect that Linux is seeing the drive as read-only because of filesystem driver issues that it's somewhat hard to explain.

What distribution of Linux did your friend install?

Linux in general isn't something I'd recommend to non-tech savvy users, honestly. I know some distributions are getting easier to use but I still feel there's potential for weird things to go wrong.
posted by Alensin at 12:28 PM on December 29, 2021

Best answer: cd to the directory

This is the kind of instruction that would have made me cry as a brand new Linux user. And I still don't do this. I might get it right by accident, I might get it wrong and mess things up; using the terminal makes me feel like I'm blindfolded and stumbling around in an unfamiliar room. Sorry, gurus!

I'm on Linux Mint. What I would do is this:

Open the file manager. It's the thing that is the Linux equivalent of Windows Explorer.
Browse your files and folders until you can see the top level of the folder (directory) that has this problem. Rightclick on that folder and open Properties.
You will get a settings window and somewhere in that window will be a section about Permissions.
It is probably set to Root.
Set the ownership to you (your username) and the access to 'Create and delete files'. File access, if mentioned, should be set to 'Read and write'.
Apply this change to folders and files within that folder, too.
Save and close.

You will probably need to type your password to prove that you have the right to make this change. If you are not being prompted, rightclick on an open space in the file manager and choose 'Open as root'; you will be prompted now. Typing your password will give you elevated privileges so you can make the change.

That should fix it.
posted by Too-Ticky at 1:19 PM on December 29, 2021 [2 favorites]

sydnius and nobeagle: wouldn't you tell a tech-non-savy user to open a bloody terminal first, so that you have a way to enter those commands and only then proceed to do what you suggest?

Which is not how you start helping a T-N-S user anyway.
posted by Stoneshop at 1:22 PM on December 29, 2021

It is probably set to Root.

Or maybe not root, but showing a number instead of a name; that number was associated with your username in the old OS. Doesn't really matter, the procedure as given by Too-Ticky will work just the same.
posted by Stoneshop at 1:48 PM on December 29, 2021 [3 favorites]

My assumption is that your "separate" drive/folder is the thumb drive. Is the thumb drive currently plugged in? If not, ignore me and listen to Too-Ticky.

If plugged in, the solution is as simple as copying all the files to your documents folder. Use your normal file manager and just drag and drop them. You would then have one copy on your computer and one copy still on the thumb drive. (Not two on the computer.) That's almost certainly what you really want. Then you can safely remove the thumb drive.

(My other assumption is that the thumb drive has been mounted read-only. And it's totally not worth getting into terminals, fstab, etc for copying files.)
posted by Snijglau at 2:25 PM on December 29, 2021

You could even have flipped a physical switch on the thumb drive to read-only, though that seems low probability. High safety though!
posted by clew at 3:02 PM on December 29, 2021

sydnius and nobeagle: wouldn't you tell a tech-non-savy user to open a bloody terminal first

On Linux? I assume you know basic terminal commands, or I would strongly discourage using that OS.
posted by sydnius at 3:21 PM on December 29, 2021

Above suggestions are all fine, but alternatively, keep that thumb drive the way it is, as a backup of your pre-linux system. Copy all the files out of it so you have them on the system and put it away in a drawer. If you want to keep your files on a thumb drive, get a new one.

If you just keep to the desktop interface, you will probably not mess up as a new linux user in a way that would make this backup relevant, but if you start opening terminals and typing in commands suggested by strangers on the internet, or ones you learn if you decide to dig into doing more with linux, that could be a different story. :) I destroyed my first 3 linux systems in horrible and wonderful ways, and have happily used it for many decades. I still keep backups.
posted by joeyh at 3:22 PM on December 29, 2021 [3 favorites]

To clarify what's been said so far, there's this concept of permissions for files, directories, and entire filesystems. Usually on Linux you'll have three types of permissions: read (meaning you can view the content of a file), write (meaning you can change the contents), and execute (meaning that if the file is a program that can be run, then you can run it, and if it's a directory then you can enter it).

There are also three types of levels for each permission. At the most restricted, only the"owner" of the file (some specific user) has the permission (i.e., only the "owner" can read, write, or execute the file). At the medium-restricted level, only users who belong to some user group have the permission. (Groups can be things like "all students in CS101", or they can be things like "all users who have access to the wifi settings on this computer".) And then there's the non-restricted level, where any user in the world can access it. The reason for this whole permissions system was historically that Unix-type operating systems were designed to run computers at organizations where lots of people would have their own accounts and their own files. An added advantage, very relevant today, is that restricted permissions make it harder for hackers or malware to mess with files they shouldn't have access to.

Finally, there's one special user or level on any Linux system, which is called "root". Root has permissions for pretty much everything (think of an apartment superintendant who has the keys to everyone's apartment). On lots of systems, "root" doesn't actually exist as a separate user (because, following the superintendant metaphor, it can be dangerous to have someone walking around with keys to everything, and what if they get into the wrong hands). But because sometime you need that level of universal access anyway, there's a way you can get those root-level "super"powers by using a command called sudo, where you enter your own password to temporarily get permission to do stuff as if you were root.

Root is what you're probably going to need to be to fix change permissions on files you don't have access to under your normal user identity. Whatever solution you end up using, if your operating system is set up to use sudo (and it probably is) then you'll be prompted to enter your own password to be able to change the ownership and permissions of the files. If it's not set up for sudo, then you'll be asked for the root password.

Anyway, there are a few possibilities for what's going on in your case.

Possibility 1: The files are "owned" by root and not by you. Or maybe they're owned by some weird owner like "previousOS" or something - the point is, they're not owned by you. You can change that either through the commandline, or through a file manager. If you follow up here about such method you prefer, and what file manager you've got if that's your preference, we can give specific instructions on how. (The reason people like to give instructions for the commandline is that the same commands are going to work on pretty much any system, whereas where you need to click and how things are labeled and displayed is going to be different for each file manager.)

2) Maybe it's not the files that are set up wrong, but the entire filesystem, as nobeagle describes - meaning that the entire filesystem is set up to not be writeable by you. (That can be handy sometimes; for example, sometimes you want to be able to plug in a usb drive and know that you won't accidentally erase anything there, or accidentally run any malware that's installed on it, and so forth.)

Can you follow up here on
(a) what distribution of Linux you're using (Ubuntu, Xubuntu, Mint, Arch, etc.)?
(b) whether you'd be comfortable using the terminal/commandline, or whether you'd rather use a file manager, and, if so, which? (Commandline is easier to give instructions for, since it's more universal, and contrary to some other commenters here I wouldn't be afraid of it. On the contrary, it's a really handy thing to learn at least a little about, regardless of whether you're on Linux, Windows, or OSX. It'll definitely make getting Linux help easier. On the other hand, a file manager might feel more familiar to you, and if you let people know what you're using hopefully someone can give specific instructions on how to figure out which problem you have and how to change the permissions using that file manager.)

By the way, I also don't agree with the "Linux isn't for beginners" comment. True, there's some basic stuff you should learn, but that's true for any OS. I have friends and family who don't know how to fix the most basic issues they run into on Windows or OSX either.

I 100% agree, though, on the value of having lots of backups.
posted by trig at 4:40 PM on December 29, 2021 [4 favorites]

Response by poster: Thank you for the replies. Too-Ticky gave me just what I needed to resolve my problem. I still don't understand where my files are. It's not a thumb drive. When the new OS as installed, the installation set aside the old files under Devices for some reason. When I click on that, the files show up as being on a removeable device, even though I have nothing plugged in. Oh well, one of life's mysteries.
posted by Stuka at 5:47 PM on December 29, 2021

Best answer: Stuka: what I figure your friend did was to set up the new Linux 'next to' the existing one. Prudent, as that would leave anything you have stored untouched, including changes to program settings and such, leaving the option to go back, for instance if the new install failed.

That disk area with the old install isn't a permanent part of the new installation, but it can be accessed from it. And like any USB stick you plug in your file manager will show you this disk area as removable; not physically removable in this case, but you can dismiss it. That's why it shows up under 'devices'.
posted by Stoneshop at 10:31 PM on December 29, 2021

Breaking & then fixing things is the best way to learn almost anything imho. I’ve based a 20+ year career in tech on essentially those skills. Back up anything that’s irreplaceable, then open a terminal & go crazy with the cut-and-paste from internet randos, and see what happens. Otherwise your computer is just a magic box that you hope mostly works, not an actual tool that you understand.
posted by rd45 at 4:05 AM on December 30, 2021 [1 favorite]

« Older Art/Design Non-Profits in Los Angeles Area...   |   Will I end up with a micro shirt? Newer »

You are not logged in, either login or create an account to post comments