New Projects - Fresh from the Labs
First up this month, we have Droopy, a miniature Web server. Now, if you're like me, and the combination of seeing the words Linux and Web server usually results in a sleep-induced coma, fear not. This actually is more useful for average Internet users. Its sole purpose is to allow other people to upload files to your PC by presenting them with a Web page interface, and its requirements are about as minimalist as I've come across.
Thankfully, Droopy has only one real requirement—Python. As 99% of you already have that installed, we can jump right into this one. Droopy itself is merely a Python script, so all you need do is head to the project's Web site, and save the droopy file to your local hard disk. You will be running Droopy through the command line, mind you, so save it to a directory that will be easy to access via the command line. The Droopy Web site recommends making the directories ~/bin and ~/uploads, and saving the droopy file to ~/bin.
Once you've done this, it's time to run the script. If you made the uploads directory, open a terminal there before running the script. This isn't a requirement, but wherever you run the script, this is where any uploaded files you receive will go.
The Droopy site and man page have an example command that inserts a greeting message and displays a picture as well:
$ python ~/bin/droopy -m "Hi, it's me Bob. You can ↪send me a file." -p ~/avatar.png
If you have Droopy installed somewhere other than ~/bin, change to path to wherever the droopy file is sitting now. If, like me, you're not called Bob, change the name (you also might want to use a less goofy message). The picture isn't a requirement, but it can help identify your page. It needn't be avatar.png either, any image file will do.
Once the script is running, you can visit a mini-Web site from any browser at http://localhost:8000/.
If all is well, you should have something that resembles the screenshot shown here. This is all well and good, but people need to upload to you. Clicking Discover the address of this page will give you a URL that you can then pass on to your friends, so they now can upload to you, provided the script is running. To upload to one of these pages, there's a rather obvious empty text field with Browse and Send buttons sitting next to it that will allow the people uploading to choose the file they want and send it to you. Once they have sent it, a notification should appear on your terminal output, and the new file will be sitting in your uploads directory.
Not being a security expert, I imagine there's probably some sort of vulnerability here (this most likely would be catastrophic on Windows), but I couldn't give any real advice in that regard. Personally, I don't have a mission-critical enterprise system, so I'm not exactly worried myself, but dig around if you're concerned. All in all, Droopy is a clever piece of scripting that is easy to install and fairly easy to use, provided that you're not scared of the command line. For those put off by transfer methods, such as IRC, MSN clones and the like (and not forgetting pesky e-mail size limits), this may be just what you're chasing.
With the advent of sudo and an increasing number of new Linux users, the possibility of users deleting mission-critical files by accident is becoming all the more real. To deal with this issue there is now safe-rm:
safe-rm is intended to prevent the accidental deletion of important files by replacing /bin/rm with a wrapper that checks the given arguments against a configurable blacklist of files and directories that should never be removed. Users who attempt to delete one of these protected files or directories will not be able to do so and will be shown a warning message instead. Protected paths can be set both at the site and user levels.
Installing safe-rm is a pretty rudimentary affair. You basically just copy one file to the right place. To begin, head to the Web site and grab the latest tarball. Extract it, and as root, copy the safe-rm file to /usr/local/bin, and rename it to rm.
Make sure the file is flagged as readable and executable for the rest of the system (as root or sudo):
# chmod a+rx rm
If this doesn't work, you may want to make a backup of the original rm in /usr/bin and then copy and rename safe-rm here. This will make your system use safe-rm in place of rm. Of course, you could leave the filename as is and enter safe-rm every time you want to delete a file, but who wants to do that?
As for usage, just use rm the same way you always have, but with the warm and fuzzy knowledge that you're not going to kill your system or accidentally cause nuclear war. Overall, safe-rm is a useful and clever modification on an age-old tool that hopefully will make its way into mainstream distros soon.
John Knight is the New Projects columnist for Linux Journal.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- Google's SwiftShader Released
- SUSE LLC's SUSE Manager
- My +1 Sword of Productivity
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Managing Linux Using Puppet
- Non-Linux FOSS: Caffeine!
- Interview with Patrick Volkerding
- SuperTuxKart 0.9.2 Released
- Parsing an RSS News Feed with a Bash Script
- Doing for User Space What We Did for Kernel Space
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide