Language Selection

English French German Italian Portuguese Spanish

Custom scripting gives users a safe-du

Filed under
HowTos

My company has a Linux cluster with a terabyte of attached storage. Over time we noticed the head node was becoming more overloaded. Inspection of the system showed that users were starting dozens of copies of the du utility to determine disk space usage. This was a natural thing for them to do, because they had a need to know how much disk space was available. A lack of disk space would cause their software builds and tests to fail. The problem was that it takes five to seven hours for a du of the entire shared filesystem. Thus, when the filesystem was nearly full (as it of course usually was), the number of du processes would increase almost exponentially.

To address this problem, we first set up automated nightly disk space reports, so that users could check the status without running du. This still did not solve the problem, as the amount of used space could fluctuate dramatically over the course of 24 hours. Users still wanted and needed to run their own du processes throughout the workday.

While adding more disk space would have solved the problem, we are using a large disk array that is already filled to maximum capacity. In general, users tend to fill up all available disk space anyway, no matter how much you give them.

We then developed a policy: users could run du on any directory they owned. In addition, user du processes would be allowed to run for a maximum of one hour of wall time. Users in the wheel group would be exempt from these restrictions.

I was given the task of developing a tool to implement this policy. Some sort of wrapper around the existing du seemed like an obvious choice: the script could validate the input, abort if an invalid path was given, and terminate the du process if it ran too long.

I wrote a basic bash script in perhaps an hour's time. Then I thought about how to run it, and that is where I ran into trouble. I had thought that I would make the script set user id (setuid) or set group id (setgid) root, i.e. when run by any user it would actually run in the root group. Then, I could change the permissions on the real du so that only root could run it. The result would be that normal users could only access the real du through the wrapper script.

Of course that would make a pretty boring article, and in reality it didn't turn out to be that simple:

Full Story.

More in Tux Machines

Feral Interactive Ports Life Is Strange to Linux and Mac, Episode 1 Is Now Free

Feral Interactive has recently announced that they have managed to successfully port the popular, award-winning Life Is Strange game to GNU/Linux and Mac OS X operating systems. Read more

Introduction to Modularity

Modularity is an exciting, new initiative aimed at resolving the issue of diverging (and occasionally conflicting) lifecycles of different “components” within Fedora. A great example of a diverging and conflicting lifecycle is the Ruby on Rails (RoR) lifecycle, whereby Fedora stipulates that itself can only have one version of RoR at any point in time – but that doesn’t mean Fedora’s version of RoR won’t conflict with another version of RoR used in an application. Therefore, we want to avoid having “components”, like RoR, conflict with other existing components within Fedora. Read more

Our First Look at Linux Mint 18 Cinnamon

Now that I’ve had about a week to play around in Mint 18, I find a lot to like and have no major complaints. While Cinnamon probably isn’t destined to become my desktop of choice, I don’t dislike it and find it, hands down, the best of the GNOME based desktops I’ve tried so far. Anybody looking for a powerful, all purpose distro that’s designed to work smoothly and which can be mastered with ease would be hard pressed to find anything better. Read more

The subtle art of the Desktop

The history of the Gnome and KDE desktops go a long way back and their competition, for the lack of a better term, is almost as famous in some circles as the religious divide between Emacs and Vi. But is that competition stil relevant in 2016? Are there notable differences between Gnome and KDE that would position each other on a specific segment of users? Having both desktops running on my systems (workstation + laptop) but using really only one of them at all times, I wanted to find out by myself. My workstation and laptop both run ArchLinux, which means I tend to run the latest stable versions of pretty much any desktop software. I will thus be considering the latest stable versions from Gnome and KDE in this post. Historically, the two environments stem from different technical platforms: Gnome relies on the GTK framework while KDE, or more exactly the Plasma desktop environment, relies on Qt. For a long time, that is until well into the development of the Gnome 3.x platform, the major difference was not just technical, it was one of style and experience. KDE used to offer a desktop experience that was built along the lines of Windows, with a start center on the bottom left, a customizable side bar, and desktop widgets. Gnome had its two bars on the top and bottom of the screen, and was seemingly used as the basis for the first design of Mac OS X, with the top bar offering features that were later found in the Apple operating system. Read more