linux

Chrooted FTP Access

FTP is an insecure, outdated and overall horrible protocol that you should never use yourself. Yet, sometimes you want to allow some people to upload files to your server, but you don't want them poking around your server or users demand FTP because they are used to it and have no idea what SSH/SFTP is.

Either way, following is how you "chroot" ftp users to their home folder, so they can't do any harm:

  • Download latest proftpd source to /usr/local/sources and change to that folder.
  • ./configure --sysconfdir=/etc --localstatedir=/var
  • make
  • make install
  • Edit vi /etc/proftpd.conf:
    • Change "Umask 022" to "Umask 002" #So, files they upload are group-writable
    • Uncomment "DefaultRoot ~" # this does actual chrooting
  • Make sure "/bin/false" is listed among the shells in "/etc/shells"
  • Create new unix user with "-s /bin/false"
  • Start proftpd daemon

Where Linus Gets It Wrong

Linus Torvalds, Richard Stallman and Eric Raymond are truly the founding fathers and patriarchs of the Free/Open Source movement. The fruits of this movement are well-known even for the non-geek audience. They include the Linux operating system, Firefox browser, OpenOffice suite, MySQL database, plus a plethora of PHP-based content-management systems like WordPress and Drupal which are the driving engines behind the blogosphere... and the list goes on and on.

Despite the fact that the three patriarchs often disagree with each other, their authority is overwhelming enough that when any of them states an opinion, it would be unimaginable for mere mortals like us to disagree with or, God forbid, criticize their ideas. Nevertheless, the "free" in "free software" stands for "liberty", the word that precisely characterizes the Free Software community, a community where any opinion has the right for existance and search for ultimate truth is the path of continued "disrespect" towards authoritative opinions. Besides, we the bloggers are well-known for our arrogance so, the heck with it! We are going to disagree with Linus Torvalds in this posting.

Blazing Fast Grep

It was somewhat of an unexpected news and an accidental finding, when I found out today that perl-compatible grep is much faster compared to the default one. I was trying to grep a 145MB text-file

grep -i 'someword' largefile.log - 14 seconds
grep -iP 'someword' largefile.log - under 1 second
grep -iP 'someword.*?' largefile.log - under 1 second

Perl-compatible regexp search is orders of magnitude faster!

It is not surprising that the two modes may be using different algorithms, however... Since perl-compatible is more generic, complex and inclusive of the simpler cases, it makes you wonder why would they bother? Why not just default the simpler case onto the more generic, Perl-compatible one and have both of them fast? I guess - one more glaring example of over-engineering waste; in this case - in a Linux classics :) I, for one, am going to always use the "-P" option from now on.

Linus Torvalds Presents: Git - Truly Distributed SCM

Linus Torvalds recently gave a presentation at Google about a new source-control management (SCM) system he has authored and that is being actively maintained by an open-source community - Git.

If you are a happy user of Subversion, you should take a break right now and watch the video (if you are a "happy" user of CVS, you are hopeless), because it will change and broaden your thinking. Git is not just another version control, it is fundamentally different the way it works.

And it is better! But, how? Ask yourself some questions about your current SCM:

  • Do you commit every day? Should you?
  • Can you commit if you are offline?
  • Do you use branches?
  • Do you look forward to merging branches?
  • Do you need to have guidelines about naming branches/tags?
  • What if your SCM server's disk died?

 

Now imagine that you have a system where none of these questions give you a shiver. That would be Git.

In Search Of Open-Source Designers.

I am a huge fan of Linux. On most counts: code quality, cultural/social, stability, performance and security, I think it is superb. There is no other operating system that I would like to see on my servers. However, there is a huge issue with Linux as a desktop operating system. And it has little to do with programmers, to be honest and fair.

The issue is the look-and-feel of Linux and other free software that come with it. The dreadful graphics a-la Windows 3.0 from two decades ago is not just a minor nuisance but effectively daunts and depresses to the extent of making user less productive. Especially when you have the polished perfection of OS-X interface to compare with. Even Mac's inferior copycat - Windows looks much better than most of the Linux software. If they can't create, in Redmond, at least they try to copy.

Linux Genuine Advantage

A colleague at work just sent this to me: http://www.linuxgenuineadvantage.org/

Well, I am glad to see that at least some people in the Linux community take the Redmond company seriously and try to respond to the "powerful" Genuine Windows Advantage program with adequate measures.

J/K :)

How to Profile Memory in Linux

Disclaimer:

I found this great article on a Linux mailing list. It is written by Jake Dawley-Carr and I honestly do not know what the copyright is on it but since it was posted on a mailing list, I assume it is in public domain. If the author contacts me, I will remove it but meanwhile, I would like to republish it because there is no knowing how long the article is going to be indexed and it would be too bad it to get lost.

 

HOWTO: Profile Memory in a Linux System

1. Introduction

It's important to determine how your system utilizes it's
resources. If your systems performance is unacceptable, it is
necessary to determine which resource is slowing the system
down. This document attempts to identify the following:

a. What is the system memory usage per unit time?
b. How much swap is being used per unit time?
c. What does each process' memory use look like over time?
d. What processes are using the most memory?

Syndicate content