Web

Configuring Simple Virtual FTP Users in vsftpd using PAM

This tutorial will set up a basic virtual user config for vsftpd on a RHEL5-based system.  I recommend that you make backups of existing config files before implementing this solution, in case you need to revert.  This allows virtual “guest” users to log in with individual usernames and passwords and have access to a base directory.

I suggest building the initial files in a directory of their own first, and the steps below outline copying the files into place.

Six simple steps:

Step 1: Create the virtual user database.

Create a text file with each username/password pair on two lines, i.e:

# cat /etc/logins.txt
username
password
username2
password2

Then, use BerkleyDB to has the file, and change its permissions:

# db_load -T -t hash -f logins.txt /etc/vsftpd_login.db
# chmod 600 /etc/vsftpd_login.db

Step 2: Create a PAM file which uses your new database.

# cat > vsftpd.pam
auth required /lib/security/pam_userdb.so db=/etc/vsftpd_login
account required /lib/security/pam_userdb.so db=/etc/vsftpd_login

# cp vsftpd.pam /etc/pam.d/vsftpd

Step 3: Set up the location of the files for the virtual users by creating a “wrapper user”.

# useradd -d /home/ftpsite virtual

Step 4: Create your vsftpd.conf config file.

# cat > vsftpd.virtusr.conf
anonymous_enable=NO
local_enable=YES
write_enable=NO    # change to YES if you want uploads available
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
chroot_local_user=YES
guest_enable=YES
guest_username=virtual
listen=YES
listen_port=10021    # optional
pasv_min_port=30000    # optional
pasv_max_port=30999    # optional

# cp /etc/vsftpd.conf /etc/vsftpd.conf.orig
# cp vsftpd.virtusr.conf /etc/vsftpd.conf

Step 5: Restart vsftpd.

# /etc/init.d/vsftpd restart

Step 6: Test.  I think you can figure this one out on your own.

Hold on to the logins.txt file, and simply update it and rebuild the DB when you need to add a user.  This allows several users access to the same directory and files.  Only give access to people you trust.

/cs

The Goosh, or Google Shell

Goosh.org – What more could you want?

I have found search engine heaven in the form of Goosh.org.

Basically, it is a UNIX-shell-styled google page, that returns listings to the “standard output” of the page.

The Goosh, or Google Shell

The beauty of it is that Google’s page has always been so simple and elegant, but Goosh takes these to the next level, making searching the web as easy as administering a Linux server, uh, sort of.

There are simple shell-like commands that you can use to manipulate the search in different ways:

web [keywords] – google web search (default if no command given)
images [keywords] – google images search
wiki [keywords] – Wikipedia search
news [keywords] – google news search
blogs [keywords] – google blog search
feeds [keywords] – google feed search
video [keywords] – google video search
place [keywords] – google maps search
translate [lang1] [lang2] <words> – goog
le translation

Those commands are modes, and you can use the “cd” command to change the default behaviour.  So, if you need a translator, simply type:

Sample of site content

cd translate

and you have a nice translator.

Other commands available include:

open <url> – open a URL in a new page
in (site) [keywords] – in-site searches
lucky [keywords] – the “Feelin’ Lucky” button

The best part, though, is this command:

addengine

This command adds Goosh to Firefox (or Icecat, in my case!) so that you can use it as your default search engine!  A simple Ctrl-K will put me in the search box, and Alt-Enter opens the results in a new tab.

I think this will be a great addition to the Google Application Suite someday, kind of like a Crazy Uncle Ned or something!

/cs

THe Fox and the Cat

Need FF2 in Hardy? Try GNU’s IceCat.

OK, so I have a special requirement for using Firefox 2. However, I run Hardy, and it has a default install of (i can’t believe it) the BETA version of Firefox 3.0b5. Golly.

So, I tried installing the firefox2 package from the Ubuntu repos, and had issues with some of the addons I use. I tried the “binary” tarball from the Firefox website. No go – it still wants to revert to FF3. As any seasoned Ubuntu user knows, don’t eff with Ubuntu. Going around making things work can sometimes cause problems with things, well, working.

THe Fox and the CatAfter some research, I found IceCat.

IceCat is “the GNU version of the Firefox browser.” Basically, the GNU guys took Mozilla’s code, and compiled it without using the “proprietary” parts, meaning the Logo and the name, among other things.

So, I downloaded the IceCat tarball. I unpacked it, expecting it to whigh out on me, as the Firefox tarball did, and low and behold! Right there next to my FF3 window was IceCat 2.0.0.13, running at the same time!

I figured it had to be too good to be true, and went about installing my needed Firefox extensions. AND THEY WORKED! HooRAH!

So, needless to say, I’m sold on IceCat as a GREAT replacement/addendum to Firefox. Get it. Use it. Love it.

/cs