Web Server File Permissions Mystery Solved

Ever wonder if this whole Linux thing is actually unholy devil worship? If you’ve ever worked on web server file permissions, you might think so. They take the right amount of searching and just short of not too much coffee for solving when a problem presents itself. (Already, I’ve probably had too much coffee, as I just caught myself bobbing up and down.) Continue reading to find out about a strange problem that might happen to you as well. I’d been watching a problem occur on a web server for about a month, where a file from a customer registration becomes unusable because the file permissions are wrong. Not just a little wrong either, bonkers wrong:


unable to open file 
/var/tmpcgi/registration.txt at /usr/local/bin/updater.pl line 33.
total 12
drwxr-xr-x. 34 wheel       wheel         4096 Aug 17 10:24 ..
--w--wx-wT.  1 wwwuser     wwwuser         30 Aug 27 05:51 registration.txt
drwxrwsr-x.  2 wheel       wheel         4096 Aug 27 05:51 .

What makes an error like that? All my scripts were setting wide open permissions on files for this process. (I know: tsk, tsk.) Despite this, the problem bugged me for weeks. I created a script just to find the oddball permissions. Actually that wasn’t a great solution, because my find command was even wrong. What could be wrong with:

find -type f -perm -220

Well, for starters it didn’t do what I wanted. So, this morning I finally searched for what creates files with “–w–wx-wT” and stumbled across something helpful. I found forum posts chastising a user for creating bug reports about his own ineptitude for using chmod “666” and not the octal chmod 0666.

Unlike that user, I *know* that I don’t want to use string 666, but it did give me something to search for:

$ grep -r 666


Now, how often do you search for the devil in the details? I wasn’t using a string, but it was still wrong. In perl, saying chmod 666, $filename; is just as bad. The 666 is decimal. Devil horns, that won’t work! Use chmod 0666, $filename; and you escape hell. Not to heaven, but to octal.

Later, I found something in my search results that you geeks will probably find useful; There is a table of unholy permissions low down in the man page for Stat::IsMode perl module. I recommend putting this in your hat for future reference!


Recommended Linux Distro

On August 10th, 2015 Jory asked…

I’ve taken on Linux a few times, tried everything from Ubuntu to Mint, even tried setting up and running Gentoo on my own. In the end however, I always default back to Windows. I don’t know if it’s because I’m an avid gamer and installing games on Linux can be a pain or if it’s because researching problems I run into becomes overwhelming or what. But after reading a bunch of your articles on Datamation, especially the W10 Vs Linux one, I’m tempted to try it again….

My question would be, what do you recommend for distros? I’m a rather tech savvy person myself, I was a computer technician and an internet technician for 4 years, although I understand that hardware/software and fixing windows is a lot different than Linux and I think that’s where my problem lies. I’m all ears and looking for more advice from someone who seems to have an amazing understanding of the systems.

A new fan,


Hi Jory,

I totally understand your frustration with trying to make the switch to Linux, while maintaining your sanity as well. Most of the time Linux issues receive a heavy-handed response when the same sort of issue with Windows is usually “allowed” by the masses. I know, I used to do this myself way back when.

With any luck, the following recommendations will help you along your way. First off, allow me to recommend my favorite Linux distribution – Ubuntu MATE.

Why Ubuntu MATE?

My main PC’s Linux distro is Ubuntu MATE 14.04. I found it to be stable to use and highly customizable. I also like the direction the distro is heading in with regard to adding new features. For example, the Ubuntu MATE 15.10 release will provide a new tool called Ubuntu MATE Welcome. This tool will provide a solid starting point where the new user can get needed applications, find support, and even have a place where they can get involved with the project. This is the distribution I recommend hands down.

Now the next consideration when trying out Linux is determining the compatibility of the hardware you’re running. While most things work just fine out of the box, every once in awhile you may have issues with video/audio/wifi. Below, I’ll share some tips on how to tackle these challenges by providing links to support forums with the information they need to be of assistance.

Getting help with potential hardware issues

Before I jump into this, remember the following: When asking for help, never post without being explicit about exactly what you did to get to the error and what hardware you have. Usually, the worst example is “my _____ doesn’t work.” Folks in the forums need to know what sort of hardware you’re dealing with. So if the issue is video related, then video card (model, brand) details are critical. Same applies for audio and wifi issues.

How do you know what hardware you’re running? From a command prompt (terminal), use the following tools to help determine what your hardware is. The following assumes you’re running an Ubuntu based distribution such as Ubuntu MATE.

Network card (even wifi):

sudo lshw -C network

Video card:

sudo lshw -C video


sudo dmidecode -t 2

Various USB devices:

sudo lsusb

Note that with USB, sometimes the resulting names listed may seem different than the brand you have in front of you. For example, sometimes running lsusb only provides details that don’t make any sense. In the past, I’ve seen Ingram and Jing-Mold Enterprise Co., Ltd listed. Neither of these lsusb results mean anything to me.

However if I run this command instead:

sudo lsusb -v | grep -E '\<(Bus|iProduct|bDeviceClass|bDeviceProtocol)' 2>/dev/null

I’m presented with “iProduct” names: “Ingam” represents my USB Gaming Mouse and “Jing-Mold Enterprise Co., Ltd” represents my USB keyboard. This information is helpful as it identifies which items are hubs, keyboards and mice.

If using the command line isn’t for you, then you can install a program called CPU-G if you have a working Linux desktop environment on the PC in question. For Windows refugees, this will feel very familiar. It provides you with your CPU, Motherboard, RAM, and system details.

To install CPU-G, you’ll need to add the software repository so it can be installed and Ubuntu updates will keep it current with new releases.

In a terminal, paste in:

sudo add-apt-repository ppa:cpug-devs/ppa

(hit enter key, then paste)

sudo apt-get update && sudo apt-get install cpu-g -y

Once completed, CPU-G appears under Applications>System Tools.

Discovering and installing software

The next and perhaps biggest consideration for a new Linux user is software discovery. For Ubuntu MATE users, I recommend installing AppGrid. Some Linux users aren’t fans of it since its source code isn’t open source, however it’s by far easier to use than the alternatives I’ve tried in the past. It provides you with a visual source of software discovery, regardless of it’s software license.

Obviously, there are alternatives if the closed source nature rubs you the wrong way. You’re also welcome to install the Ubuntu Software Center. On Ubuntu MATE, if it’s not already installed, you can get it installed by pasting this into the terminal:

sudo apt-get install software-center

Starting with Ubuntu MATE 15.10, you’ll also have access to a tool called Ubuntu MATE Welcome (mentioned previously) which will help provide a solid launching point for applications most people might consider critical.

Bringing it all home

So Jory, that is a ton of information I dropped into your lap. And while it might seem overwhelming at first, it really breaks down into the following:

  • The importance of providing the correct hardware information.
  • Tools to discover and install software.
  • Which Linux distribution I recommend.

If you follow the advice above, I have no doubt that you’ll have a good time diving into Linux on the desktop and throughly enjoy the experience.

Before taking the next step and installing Linux onto your hard drive, remember this: run a live installation on a USB key first, since it won’t touch your hard drive. Test out playing audio, video and wireless networking. If you’re happy with the results, then you can look into installing it along side Windows so you don’t have to give up any games.

Do you have Linux questions you’d like Matt to help with? Hit the link here and perhaps you too, can Just Ask Matt!

Building My Own Ubuntu


You probably don’t need to build your own distribution of Linux. There are already so many to choose from and with a bit of research, I bet you can find one all prepackaged and ready to download that will do what you want it to. Right? Then again, why shouldn’t you? Even well seasoned Linux users tend to forget just how modular Desktop Linux really is. People also tend to think that the only folks who can put together their own distros are natural-born hackers who live in a terminal all day. Not true at all! Anyone who has a good basic understanding of what a Linux Desktop is made of and can execute a few simple commands in the right order can build their own Ubuntu based Linux Desktop. It’s easier than you think and it can be a great learning experience too.

Even if your build doesn’t turn out to be what you needed, you’ll have a better understanding of Linux. Plus a deeper respect for the folks who develop and maintain the popular ready-to-install distros we have to choose from today. Yeah, you really ought to build your own Linux distro after all.

Let’s start with a few principles first, shall we?

What we call a Linux Desktop Operating System is actually just a set of programs that work together to give us the illusion of a cohesive computing experience. The name Linux refers to the kernel only. The same Linux kernel can run a TV, router, smartphone or even your refrigerator. To understand this a bit better, let’s take a moment or two and go through what actually happens when you boot up your computer. I’m going to way oversimplify this; there are actually thousands of steps in the process, but we’ll only talk about the big ones.

Step one is to load the Kernel and the bootloader, which is what gets that accomplished when you first turn on your computer. The GRUB (Grand Unified Bootloader) is pretty standard for Linux these days. It lets you choose between different OS’s that might be installed on your machine and it also has some options to boot into special kernel modes for troubleshooting issues or running diagnostics. Most Ubuntu users don’t even see GRUB unless they are running a dual boot. The bootloader starts the process that initializes the system and loads the kernel. Now we can talk to the computer, but with just a kernel we can’t do much.

Next we need a shell. You’re familiar with the Bash shell that runs in a terminal emulator on your desktop? Same thing here. It has a few built-in commands but is really only useful if it’s bundled with utilities and programs that are designed to work with it to get the actual work done. The shell plus these utilities from what is known as a base system. Most server implementations of Linux are nothing more than a base system with a few server type applications installed. Servers are just robots that run in a rack somewhere sharing files or managing databases, they have very little interaction with their masters and don’t need any kind of GUI (Graphic User Interface.) Boring as hell, if you ask me.


To make our Linux system a bit more exciting and useful, we’ll need to add some more stuff to the system. We’ll need a Display Server to actually put something other than text on the screen and let us use touchpads and mice to interact with our computer. Xorg has been the standard display server for decades and most Linux heads just call it ‘X.’ There are newer display servers on the horizon that premise more speed and functionality like Mir and Wayland. What does the display server do? Basically, it draws pictures that other applications tell it to on your screen. It is what talks to your graphics card and tells it what to do. Fortunately, X is pretty much setup automatically these days and the average user should never have to deal with any manual configuration. X won’t do anything by itself, though. We need more stuff to get anything useful out of it.

The next thing a modern desktop needs in the boot order is a Display Manager. If you log into a system with no X installed, you’ll be presented with a very simple login prompt and once you provide your user name and password it will dump you at a prompt and wait for you to type in a command. You could install Xorg and then install a Desktop Environment (DE) and skip the display manager entirely but that would mean that you’d have to start X and load the desktop manually every time you logged in. It would probably get really old after a while because most of us just wanna jump right into a GUI and start pointing and clicking away. The Display Manger takes care of the login stuff and it adds extra features like the ability to use more than one desktop environment and allows you to do fancy things like switch users.

Most Linux DE’s use their own DM’s: Ubuntu’s Unity uses LightDM, Gnome uses GDM, Linux Mint uses MDM, KDE uses KDM and so on. There are actually many to choose from and the main reason I’m taking the time to talk about them is because some desktops don’t have a default and you would have to choose one if you were doing your own install from scratch. For instance, XFCE doesn’t pull in a DM automatically when you install it and you may find yourself scratching your head, wondering what went wrong. Typing in the command ‘startx’ will get you XFCE, but you don’t wanna do that every time. Or, maybe you do! What if you’re working with a server and you don’t plan on running it in graphics mode all the time? Well, easy-peasy, just don’t install a display manager with XFCE. Done.

While we’re on the subject of Linux and DM’s, it’s interesting to note how it integrates into the shell. When you boot Linux without any GUI, you are dumped into what’s called a TTY. This is a virtual terminal. You’ll notice that it usually says that you are in ‘tty1’ There are several TTYs available at startup and you can move from TTY to TTY by pressing Alt and Ctrl keys and selecting the TTY by pressing the cosponsoring function key.

TTY1 is F1, TTY2 is F2, TTY3 is F3 and so on. How many TTY’s there are depends on the distribution and you can be logged in on several TTY’s at once.

The DM usually is assigned to TTY7 or TTY8 and the shell automatically switches to that one at startup once the DM is installed and auto-configured. If you’re using a Linux computer to read this article, you can try it right now. Don’t worry, you won’t lose your place. Try pressing Alt+Ctrl+F1 right now and you should go to a text login. To get back, press Alt+Ctrl+F7 or F8. See how it works? How cool is that?

The full super-simplified boot process looks like this: GRUB + Kernel + Shell + Desktop Manager + Desktop Environment.

This brings us to the Desktop Environment and we have many to choose from here. You could opt for a super simple Window Manager like OpenBox or install KDE’s latest Plasma Desktop Environment. Here’s where you need to do a bit of research because the waters get a bit murky once you’ve chosen your DE. First off, you gotta decide from where it is your desktop environment that packages will come. Ubuntu has most of them already in the standard repositories and installing them can be as simple as issuing a command to install one package that will pull in most of what you need, including Xorg and a Display Manager. Nice.

The only problem is that the DE’s in the repos are sometimes older versions and you may want the latest greatest in your custom install. This most likely means that you’ll have to add a PPA or two to your base system to get those packages. Whatever you decide, you need to do a bit of reading to determine the best path for you. A great place to start is the Desktop Project’s website. Most have pretty comprehensive instructions on how to get started from a base system. There are a lot of great blog posts and videos out there too. Just keep looking until you feel confident you can do it.

Getting a base install of Ubuntu is easy. You can do one of two things: use the Network Installer to build a base system by not installing any desktops when it asks you what flavor of Ubuntu you want. Or you can also get the Server version, install it and then use a tool called ‘tasksel’ to remove all the server components, leaving you with a base Ubuntu system. I think using the Network Installer is probably the best way to go but it does take some time and a good, solid Internet connection is a must.

To get it you must first go to Ubuntu.com and then go to the Downloads tab. Click on ‘Alternative Downloads’ in the menu. You’ll find all kinds of links to different versions of Ubuntu, but the network rattlers will be listed right up at the top. Chose your version and then choose the download that you want. You can pick different kernel versions here too. Once you’ve made your choice, you’ll be taken to an FTP menu that offers a bunch of files to download. The one you want is called ‘mini.iso.’ This is your installation media and all you have to is boot your machine from it and then follow the prompts.

When it asks you what software to install, the only thing you might consider is a print server. If you choose a listed version of Ubuntu from here, it will install a prepackaged spin, not just a simple desktop. It is important to keep in mind that you’ll need a wired connection for all of this to work.

Once you’re desktop selected a desktop and it is up and running, you’ll probably need to edit a file to get the Network Manager applet to control the network on your machine. This is also necessary if you need to activate wireless access. Here’s a good source of info on how you do this at Help.Ubuntu.com.

Now that your basic desktop is installed, the fun really begins because it won’t include all of the things you’re used to getting. Every app, every utility and even a web browser will have to be installed manually. You’ll most likely have to get your own icon themes, backgrounds and window decorations as well. You can make it as tricked out as you like or just install the basic stuff you need and leave it at that. The main thing is that it will be what you want, nothing more and nothing less. Now, that’s what I call freedom! Now, watch my video and see what I came up with. It might give you an idea or two.

OK, OK… I see some of you are chomping at the bit and can’t wait to try this, so here’s a command you can use on a fresh base Ubuntu install to get a very basic XFCE DE to play with:

sudo apt install xfce4 xfce4-goodies slim firefox software-center

To get all of the third party multimedia codecs and fonts, run this command before you restart:

sudo apt install ubuntu-restricted-extras

When the EULA comes up, use the tab key to select OK and then use the arrow keys to choose ‘yes.’ After you are all done, restart your system and start playing!

Have fun!

What do you do with bugs?

Software bugs are an everyday fact of life, and the sad truth is we’re never going to be free of them. What causes them, and what we can do when we encounter them is what we’ll explore here.

Anyone who develops software starts on their own computer. They have a specific make and model of machine, with all the hardware that manufacturer decided to incorporate in building it. The programmer is using whatever disto they prefer, with that distro’s choices of lower level software (kernel, modules, libraries), and that distro’s spin on their desktop environment of choice. The programmer is also using the support libraries for whatever environment they’re programming for (GTK+, KDE, etc.). When they’re at a certain point where everything they’re trying to accomplish with their application works, it’s usually pushed out for some process of review, where they hope to catch any glaring bugs and fix them before release.

Think about all the variables involved in that process. Start with the programmer’s computer. How many different makes and models of computers are there? All computer manufacturers have one thing in common, they’re trying to make money while at the same time keeping costs low. They mix and match pieces, change hardware configurations, use differing makes and models of peripherals, not to mention core components like the motherboard, chips, bus types, etc. The sheer number of possible hardware variations is staggering.

Next think about the programmer’s distro of choice to work in. Every distro does something different with their core components to try and stand out, be what they feel is better than the others. They can and do change how they compile their kernels, modules, libraries, as well as how they interact with each other. Source code versions can be different, compile time flags are changed, init systems, what’s started, how and when, can all be modified. Another mind-numbing amount of variations is possible.

Then there’s the toolkit the programmer is using. Most will work with whatever is current and supported by the environment they’re targeting, and make any support libraries their application needs “requirements” for packaging. Unfortunately, it’s the distro we choose to use that has to compile and package those requirements, and they might do something different from what the programmer desired or used themselves.

The plain fact is, there are so many variables involved in computers and computer software, a programmer or team of developers can’t possibly foresee or account for them all. The very best developers can’t program for, nor anticipate, all the possible environmental and hardware variations their software is going to encounter in the wild. Many larger projects have Q&A teams or similar, where they try to “torture test” software to find and fix bugs before it’s released. While it certainly helps a lot – much is caught and fixed in the testing – it’s still impossible to account for every variation. We as users are going to find bugs sooner or later.

So before you go on a tirade in social media or other public venue about “buggy crap” software (you can insert your own vile and demeaning adjectives here), think about what the developers are up against. Think about what you are doing. In the FOSS ecosystem you’re railing against people who gave their time to create something good and useful, then gave it freely to the world. Often at some personal and/or economic costs to themselves. In essence, you’re dragging over the coals someone who is trying to help you!

Consider this: Apple controls both hardware and software creation on their platform. They build the hardware, so they know exactly what is in it. They create the software to work with that hardware. They control the toolkits, libraries, kernel, modules, init, everything. They have an extensive and thorough Q&A that all software has to pass. And they STILL have bugs!

As I said when I started, bugs are a computing fact of life. There will always be bugs, the sheer number of variables in modern computing makes that inevitable. However, we in the FOSS world have an advantage. We can do something about the bugs we encounter. We can be proactive, and we don’t need to be a programmer to do it. Almost all software projects have bug trackers, systems where users can report bugs and help find a solution for them. Those that don’t will at least have an email address or IRC channel, some form of contacting the developers. All that’s required is a little patience and a willingness to spend some time helping find a solution. Time and patience, these two things are vital to squashing bugs. If we take a few minutes to just browse through a bug tracking system, we’d see hundreds (if not more) cases of someone reporting a bug with little to no information useful to the developers, and never following up. Or worse, ranting about a bug without even trying to be helpful in squashing it.

The only way a developer can kill a bug is if they understand exactly what’s causing it. The only route to understanding is if the user supplies all the information necessary, and follows up with whatever further tests or information the developer needs. It requires time and patience. It also helps to have a positive attitude and be polite. In the course of trying to kill the bug, the developer may ask you to do or try something you don’t understand. If and when that happens, tell them you don’t understand and ask for guidance. Remember, you’re both asking for help with a problem. They need your help to fix the problem, so don’t be shy in asking for their help in return. Most importantly, stick with it. There IS a solution, it just might take some time to find it. Chances are it’s working properly on their system, so they need to diagnose what is different between your system and theirs, and then figure out what to do about it.

Not all users can be bug chasers. Many of us just don’t have the time or patience for it. That’s okay, because we can still be helpful. How? By NOT trashing the software or developers because we have a bug. Put yourself in the developer’s shoes. You’re trying to create something useful and giving it freely to the world, and someone is publicly flaying you for it? How would you feel? Don’t be a troll. If you don’t have the time or patience to help with a bug, that’s fine. But don’t be a troll instead.

For those of us who do have the time and patience, chip in! It’s the beauty of FOSS, even those of us who aren’t programmers can still be actively involved in software development. Report the bug. If it’s already been reported, add your information. Most bug trackers have a guide for how to submit information, follow it and include yours, don’t just add a “Yeah, I have that bug too.” The more information the developers have on how a bug is affecting users, the more likely they are to find a solution. Then take the time to follow up on it to its resolution. By staying actively involved until it’s fixed, you’ll be able to honestly say “Yep, I helped in the development of that.” You’ll have changed from a being a “user” to being a “contributor”. Then the real reward happens, you get to soak up the feel-good that comes along with the knowledge you’ve helped on something the whole world can use.


Transcribe Speech To Text With Linux And Google

Sometimes in life, you run into situations where turning a voice recording into a text document is necessary. Perhaps this is from an interview for a news publication or perhaps you need to transcribe a verbal lecture from school. On Windows and OS X, there are a number of software programs that can help with this. Yet for Linux users, the options feel a bit sparse by comparison.

Today’s tip will address this issue. In this tip, I’ll show you how to combine Google’s Web Speech API with the Linux sound management server, PulseAudio.

Ready to get started? Great, here’s what you’re going to do:

1) Install pavucontrol (PulseAudio Control). It’s available from most software repositories.

2) Open pavucontrol (PulseAudio Control), click into the Input Devices tab. At the bottom, set Show to Monitors. Select the monitor that reflects the audio device you’ll be listening from by clicking the box next to the padlock on the right side. In my case, this was the USB speakers.

3) Now goto the Output Devices tab, make sure the matching output device is selected by clicking the box next to the padlock on the right side. Leave this app open, for troubleshooting.

PulseAudio Volume
PulseAudio Volume

4) Install/Open Chrome, browse to Google’s Web Speech API Demonstration page.

5) Now open up your audio player that will play the audio file. Get ready to play the audio file, but don’t hit play just yet.

6) Back on the API Demonstration page in Chrome, click on the microphone icon in the right center of the page.

7) Now in the audio player, hit play.

If everything went well, you should start seeing text appear on the Chrome page. If it isn’t working, re-check your settings. Another reason why it might not work is because of music or other noises in the background making voice audio difficult to detect.

Bonus fun: This also makes for a fun game of Mad Libs, by using a separate tab for YouTube podcasts. Some of the results are quite funny!

Introducing Jed Reynolds

I’m honored that Matt Hartley asked me to contribute to Freedom Penguin. In upcoming articles, I’ll be sharing some stories about things I’ve learned during my journey as a professional programmer analyst. I program in multiple languages like Java, Perl, bash, and also write end user documentation in PHP and do my own CSS.

I fix my own computers, and pride myself in being mechanically competent. I also fix my own bikes. (But don’t fix people.) For example, back in college around 1994, one of my friends who was getting a job asked me advice about getting a car. She probably asked the wrong person: I said  that all the cars I’ve owned, or been around, all needed work. Water pumps, starter motors, plug  changes and so forth. She was quite anxious after I went quiet on the topic. She asked, “I can’t  spend all my time fixing cars, I need to get to work. Will anything just get me to work?” I then told her, “Well, a Toyota will. They won’t break a lot.”

(Surprisingly, the Toyota’s I have owned have done pretty well by me. I own a 2000 Sienna that keeps on ticking. Real guzzler by modern van standards, however the thing could tow a boat.)

And that’s (almost) how I think of Linux. It’s pretty dependable, but you’ve gotta roll up your sleeves once in a while. My family all have Ubuntu laptops. And as a result, I don’t have to worry about adware. Also stuff is easy to back up. The kids can game on these PCs, and only game just enough that they’re not bugging me for those fancy water cooled rigs. Luckily for me, I can keep the family running happily on used or refurbished hardware for the indefinite future. Similar to how I would view buying a used Toyota. I tend to think of myself as the family Linux mechanic.