I decided to simply create directories within /mnt, chmod 000 them and use them as fixed mountpoints;
for manual temporary mounts I have /mnt/a, /mnt/b, … /mnt/f, but I never needed to use more than two of them at once.
While this setup doesn’t really respect the filesystem hierarchy, I wouldn’t have used /mnt at all if I were constrained by its standard purpose since having one available manual mountpoint seems pretty limiting to me.
Then again, I have 3 physical drives with ~ 10 partitions, plus one removable drive with its own dedicated mountpoint…
chmod is the command to change user permissions. The numbers mean user, group, and others and the value allows read, write, execute. So, 000 means no one has permissions to get rid of the mount point. 777 means everyone has all permissions. (4 is read, 2 is write, and 1 is execute and the numbers are added. So, 644 would mean you can read/write, the group and other users have read only access.)
You don’t have to use the numbers but eventually, almost every Linux admin does because it’s faster, a bit like a keyboard shortcut. But, for instance, you can add Execute permission with chmod +x /some/file/location.
chown changes the file owner. chmod changes permissions. So, if a file or directory is owned by root but a user should have access, you could make them the owner or you could keep root the owner and just allow read/write access.
They come up more on servers where you often have multiple users with different access levels. Some users might not have sudo permission but do have full control over their home directory and whatever else they need. And web servers, for instance, will usually have a user called www-data or similar and it’s shared by all the users in the “developer” group.
I use chown 000 so that regular users fail to access a directory when no filesystem is mounted on it; in practice it never happens, because “regular users” = { me }, but I like being pedantic.
As for /mnt, it is supposed to be a single temp. mountpoint, but I use it as the parent directory of multiple mountpoints some of which are just for temporary use.
No, directories without anything mounted on them are normal directories - which checks out, since you can mount anything anywhere; unlike Windows volume letters, which only exist when volumes are mounted or detected by the OS.
When you mount a filesystem onto a directory, the OS “replaces” its contents AND permissions with that of the filesystem’s root.
Here’s an example with my setup (hopefully you’re somewhat familiar with Bash and the output of ls -l).
Imagine some random filesystem in /dev/sda1 owned by “user” which only contains a file named “/Hello World.txt”:
<span style="color:#323232;">$ # List permissions of files in /mnt:
</span><span style="color:#323232;">$ # note that none of the directories have read, write nor execute permissions
</span><span style="color:#323232;">$ ls -la /mnt
</span><span style="color:#323232;">drwxr-xr-x 1 root root 168 May 31 23:13 .
</span><span style="color:#323232;">drwxr-xr-x 1 root root 128 May 31 23:14 ..
</span><span style="color:#323232;">d--------- 1 root root 0 Aug 1 2020 a/
</span><span style="color:#323232;">d--------- 1 root root 0 Feb 11 2022 b/
</span><span style="color:#323232;">d--------- 1 root root 0 Aug 11 2021 vdisks/
</span><span style="color:#323232;">
</span><span style="color:#323232;">$ # No read permission on a directory => directory entries cannot be listed
</span><span style="color:#323232;">$ ls /mnt/a
</span><span style="color:#323232;">cannot open directory '/mnt/a': Permission denied
</span><span style="color:#323232;">
</span><span style="color:#323232;">$ sudo mount /dev/sda1 /mnt/a
</span><span style="color:#323232;">
</span><span style="color:#323232;">$ # List again the permissions in /mnt: the root of /dev/sda1
</span><span style="color:#323232;">$ # has rwxr-xr-x (or 755) permissions, which override the 000 of /mnt/a ...
</span><span style="color:#323232;">$ ls -la /mnt
</span><span style="color:#323232;">drwxr-xr-x 1 root root 168 May 31 23:13 .
</span><span style="color:#323232;">drwxr-xr-x 1 root root 128 May 31 23:14 ..
</span><span style="color:#323232;">drwxr-xr-x 1 root root 0 Aug 1 2020 a/
</span><span style="color:#323232;">d--------- 1 root root 0 Feb 11 2022 b/
</span><span style="color:#323232;">d--------- 1 root root 0 Aug 11 2021 vdisks/
</span><span style="color:#323232;">
</span><span style="color:#323232;">$ # ... and its contents can be accessed by the mounted filesystem's owner:
</span><span style="color:#323232;">$ ls -la /mnt/a
</span><span style="color:#323232;">drwxr-xr-x 1 user user 168 May 31 23:13 .
</span><span style="color:#323232;">drwxr-xr-x 1 root root 168 May 31 23:13 ..
</span><span style="color:#323232;">-rw-r--r-- 1 user user 0 Jul 4 22:13 'Hello World.txt'
</span><span style="color:#323232;">
</span><span style="color:#323232;">$ find /mnt
</span><span style="color:#323232;">/mnt
</span><span style="color:#323232;">/mnt/a
</span><span style="color:#323232;">/mnt/a/Hello World.txt
</span><span style="color:#323232;">find: ‘/mnt/b Permission denied
</span><span style="color:#323232;">find: ‘/mnt/vdisks’: Permission denied
</span>
Please note that me setting permissions is just extreme pedantry, it’s not necessary at all and barely changes anything and if you’re still getting familiar with how the Linux VFS and its permissions work you can just ignore all of this.
The benefits are marginal, for example I can see if a filesystem is mounted by simply typing ll /mnt (ll being an alias of ls -lA) - it comes handy with my system due to how I manage a bunch of virtual machines and their virtual disks, and it’s short and easy to type.
Some programs may refuse to write inside inaccessible directories, even if the root user can always modify regular files and directories as long as the filesystem supports it.
It’s not a matter of security, it’s more of a hint that if I’m trying to create something inside those directories then I’m doing something wrong (like forgetting to mount a filesystem) and “permission denied” errors let me know that I am.
it’s more of a hint that if I’m trying to create something inside those directories then I’m doing something wrong (like forgetting to mount a filesystem) and “permission denied” errors let me know that I am.
Now I understand.
This is all new to me bro.
Even I don’t know if I will go this further to explain something to someone.
It ultimately doesn’t actually matter because in many cases these things are convention and there is no real system-based effect. So while it would be especially weird if your distro installed packages into those directories, it ultimately doesn’t matter. Someone already linked the filesystem hirearchy. See how tiny the /media and /mnt sections are?
I put my fixed disks into subdirectories under /mnt and I mount my NAS shares (I keep it offline most of the time) in subdirectories in /media.
Why ? that’s what I’m asking. Can’t you just put in the same folder and call it a day?
I put my fixed disk in /mnt
My Files, which are inside the partition mounted in /mnt/something has root as Owner. So When I try to move something to Trash, it’s not allowing me to do, Only perma delete. When saw properties it said owner is root.
Is it because mounted at /mnt?
Files under /media seems fine. files under /media says it’s owner is ‘me’
If you try to mount 2 drives to the same location, like /media/drive, the last one that you mounted will just replace the first one. You could put one at /media/drive1 and the other at /media/drive2 though.
It doesn't matter where you mount stuff, like it won't break anything, as long as you're not replacing an existing directory like I mentioned.
I also just saw your edit. Look into Linux ownership and permissions. chmod and chown are important commands to know how to use as a Linux system administrator.
Running sudo chown -R user:user ./drive in /mnt will give your user account ownership of that directory and all folders inside of it.
Make sure you replace user with your username and drive with the name of the mount point for the drive.
Hm, you probably can, but I personally don't and I'm not sure which file manager you're using. I like the terminal for this because it's quicker and easier to do (or undo if you fuck up).
I also gave you the wrong command earlier, sudo chown -R user:user ./* doesn't affect the top-level folder (e.g., /mnt/drive). My mistake.
Mounting to a specific location should not affect the permissions of the drive. But in the case of NTFS and some other filesystems, Linux is not compatible with their permission model, so it is simplified by e.g. making all files be only accessible by root.
You can override this default with mount options, or change the permissions to sensible values with chmod and chown, but I’m not sure if changing them will have negative side effects on the windows side so the latter may not be a good idea.
I would recommend to put them inside /mnt for internal disks. It’s a bit more organized that way, and by looking at the path is easier to know that it’s in an internal drive.
When I did dual boot (good riddance) I gave Linux <100 GB and rest to Windows. I had additional storage partitions but in long term they made management harder for me so I mounted Windows partition for additional space. Here are my recommendations:
Merge “Mint” and “Timeshift” partitions.
Use BTRFS if you can. In rsync mode of timeshift, the disk will hold 2 copies of your current system + changes between snapshots. In BTRFS there will be 1 copy + changes. BTRFS also supports compression.
System wide flatpaks are in /var/lib/flatpak/app. Flatpak installed for one user only are installed somewhere in ~/.var. Keep in mind that home directory is not backed up by default.
If you can, ditch dual boot. If the reason of keeping Windows is MS Office or Adobe apps, you can install them on Wine.
I thought (also most people said) keeping the Backup in same partition as root defeats the purpose of Backup and brings certain inconvenience like can’t just delete the partition. Also I don’t know if its possible to restore a backup from a partition to the same partition itself.
Use BTRFS if you can.
I’m aware that BTRFS has certain adavantages. But the whole BTRFS is alien to me, as I’m new to Linux. Also I assumed that BTRFS doesn’t have enough community support as ext4 is default on Linux and many people just aren’t bothered to change it.
If you can, ditch dual boot. If the reason of keeping Windows is MS Office or Adobe apps, you can install them on Wine.
I only use Windows for DaVinci Resolve Free. And for the possibility of requiring Windows exclusive programs in the future as I’m an Engineering Student.
System wide flatpaks are in /var/lib/flatpak/app. Flatpak installed for one user only are installed somewhere in ~/.var. Keep in mind that home directory is not backed up by default.
Btrfs uses snapshots and subvolumes. It is not a traditional partition and can restore to itself.
I think Timeshift is primarily a snapshotting tool for a quick rollback if something breaks. I would not consider it a full backup tool, there are tools that are much more robust and configurable for keeping files safe and elsewhere.
I would recommend using Timeshift. BTRFS mode can create local snapshots and rsync mode can be used to backup to external media. Timeshift can exclude directories based on user preferences.
As the other user says, btrfs is well supported. In fact it is preferable in your case, as it allows you to use transparent compression for the whole system. In addition, btrfs snapshots are also drastically safer and faster.
You can convert it from ext4 to btrfs, but I don’t know how well it works. If you are going to do it, I suggest you check it carefully and make a backup.
My Files, which are inside the partition mounted in /mnt/something has root as Owner. So When I try to move something to Trash, it’s not allowing me to do, Only perma delete. When saw properties it said owner is root.
Is it because mounted at /mnt?
Files under /media seems fine. and says it’s owner is ‘me’
/mnt is not for everything, it is a temporary mount point. For fixed drives that are constantly mounted you should use another location (that could be anywhere in the filesystem tree).
Technically, no. Until you want to mount something but find /mnt is busy or simply forget about this and mount something there, losing access to previously mounted stuff. The only problem is that you have to remember which mountpoint you use for particular filesystem, while the FHS is designed to avoid this and abstract from physical devices as much as possible.
It was kind of an upstart thing and people were trying to find ways to monetize it.
My first Linux was Red Hat on a 486 in 1998 and it was different than I was used to. I was a kid who didn’t know how to startx so I just emailed a developer using pine and they helped me figure out and choose a window manager. Nobody even got mad at this barely teenager just emailing dumb questions. I got lost with fvwm95 and afterstep. I tried every window manager, mlvwm, qvwm, IceWM, etc but ended up liking blackbox the most. I had 12MB of RAM on my first Linux system, 1MB of vram and 256 colors. We were all sarcastic in a cringe, adolescent way but everyone was friendly and helpful.
There was this fascination with monkeys in pop culture, but not real monkeys --chimps and gorillas. People would throw monkey in their username or in some random nu-metal song for some reason. There were monkeys you could download for your desktop. There was this thing by PC gamer called coconut monkey. I don’t know what that’s all about. And anyway I associate this period with the foot logo of Gnome, which was unprofessional but that was the point. Also, gimp was a funny name for an app (its cringe today), and PAN stood for pimp ass news.
I discovered Slashdot and Freshmeat and Sourceforge and kuro5hin. Usenet groups were great back then. So was irc. I trolled Slashdot and got negative karma and for the next 15 years before we all moved to SoylentNews, my comments started at -1.
Nobody knew how to pronounce Linux. Some people said Line-X because his name was Linus like on Charlie Brown, and some people said Leenucks.
At some point it became a corporate thing and the term Linux was everywhere. Randomly on magazine covers. There was also this divide, almost marketing driven, it seemed that people who liked warez and whatever started to love Microsoft and shit on Linux. So gamers especially started to shit talk and that’s the first time that being a computer nerd wasn’t like this unifying concept, there was an us versus them divide. People who could compile code they wrote and who were genuinely curious versus people who just wanted to download a bunch of shit and show you how big their start menu was and play games. I think this divide still exists.
There was a bunch of commercial software for Linux too. Metro-X, Accelerated X, Motif, Applixware, Star Office. Descent 3. One of the Quakes. Motif, the toolkit, looked amazing. I thought CDE with themes was the coolest looking thing ever. But I couldn’t afford CDE so I used XFce which was an XForms knockoff. And then enlightenment came along and pushed the boundaries of what we thought a desktop would be. Also, I was able to drag console windows with transparency on that 486 on e16.
Debian kind of had an elitist community and talked down to people so I never used it. I liked Slackware the most and spent a weekend downloading the floppies over a dialup connection. That led to me discovering FreeBSD in 1999, which I stuck with for almost a decade.
Later, a comp sci student, I didn’t see Linux at university in the labs. It was Solaris and macOS in the mid 2000s. Eventually, the Solaris computers were shut down and replaced with more Macs.
My girlfriend’s Windows ME computer was so full of spyware so I installed SuSE with KDE on it for her in her dorm. And she was able to do her papers in AbiWord. And 20+ years later we are married and it all worked out.
I finally switched to Debian stable about 4 years ago and have no complaints. It’s a lot easier now.
Edit: A couple more things: I started using Linux because I was very poor and it was free and Windows 95 was a mess on my system. I mean dirt roads and no water for long periods of time. My 486 in 1998 was sort of old already and it came with 8mb of RAM as a hand me down in 1995, but I was dumpster diving outside a community college when I was 12 and found an IBM PS/2 and stole the 30 pin SIMMs out of it. And one of them worked in my 486 computer so I ended up with 12mb of RAM. I overclocked it to 100mhz. That 486 got me through high school and into college where I ended up with an AMD system with a pirated Thai RM233 Windows 2000. But I went back to FreeBSD because I needed a compiler. So that kind of knowledge was useful and now that I have a good career from what I learned, I have donated a lot of money over the years to different projects. Also I make sure my kids have only ever known Linux and Gnome and it works fine for them.
There’s also /run/media/[username]/. Don’t know if it’s an OpenSUSE thing or Plasma but everything I mount through KDE’s file manager Dolphin ends up there. Including stuff I set up to mount automatically.
su is the best. I mean, i should be using the admin (root) password for admin things, not the user password of user who is already logged in. And there needs to be a root service already running to make user have root previlages which is dumb imo. Sudo vulnerability could cause previlage escalation but if there is no root process managing this, then it can’t leak the root access. Only kernel security issue(or other root processes) will leak root access if that was the case, which i think is better.
The permission to do admin things is given by the root user, to your account. So you have to verify your identity by entering your password.
Isn’t that how it is? I though that was analogous to how almost everything worked IRL. Whether withdrawing funds from a bank or engaging government services, you prove your identity as a customer/citizen to get the relevant services. At no point do you login to bank or government computers with full privileges.
If you own your own bank, then i think you login as the one with full previlages. Yes when doing administrator things, you have to use sudo. The problem with root with sudo is, you authenticate as a user, then gain full permission from root, i.e analogous to login in to bank with full previlages.
As a person who need to run sudo command its better to just verify yourself as root user to gain “full access”. I’m not saying about partial previlages. That is i just need a script which is just su -c with environment variables being copied
I‘m running my own IT company since recently and am transitioning to exclusively using FOSS. I still have some things I need to work around like my iOS phone. It already has a linux successor but its not finished yet. Pretty promising though. My plan is to put a fixed percentage of profits to open source projects.
Sorry, no idea what you mean. I use the phone the same way I use my computer. I’m sticking to stuff that would probably pop up if it were to get compromised, otherwise I dont bother.
Ah I mean when you buy for example an Intel CPU it has IME enabled. Some vendors turn this off for you, because doing it at home can brick it. For phones you have some kind of micro Java running on the sim chip and it has full system access and can be patched remotely. I haven’t looked into a real solution yet, but you can also use a solution where the sim is connected via USB. Or don’t use one. There might be other hardware vulnerabilities, but that’s one I know of.
This is not tangental - I am heartened, my hope is that this would become normal. Despite my moan, it isn’t that bad and I’m sure I would have had different IT headaches on windows - security comes to mind.
I still use proprietary android software on my phone, but I try not to do anything secure on my phone (this is also getting harder as banks are insisting that I convert to apps)
Thanks! I‘m currently working with a customer who uses microsoft cloud stuff and windows. Honestly, I would have been done with my work after 20 minutes if he were on linux. Instead I‘m at 8 hrs and a full blown storage solution just because his hardware is incompatible with each other die to windows/microsoft BS.
I can not stress this enough: there are lots of issues on windows which require costly support while the issues on linux usually require a search engine or a friend with some linux experience.
The downside of postmarketOS at this point is the camera functionality. We need to get that working and we‘re golden. On the oneplus 6 I‘m working, its the only major thing that doesnt work. Otherwise the phone is pretty ready.
I like to mount drives at root, their parent directory being the logical purpose of the drive.
Got a drive you added that’s gonna be for games?
/games
Is it for movies?
/movies
Or maybe it’s just general data storage?
/data
No need to make it more complicated than it has to be.
This is standard across the industry, unless you are mounting disks that would conform to another strategy (say it’s a drive of repos, it might mounted under /usr/local/src/ as that’s where one would expect user provided source code).
linux
Oldest
This magazine is from a federated server and may be incomplete. Browse more on the original instance.