Archive for September, 2007

Allow Chroot VSFTPD User External File Access

Scenario: FTP user is jailed to their home directory with chroot. FTP user needs to access an external directory (such as www).

Normally you would create a symbolic link in the user’s home directory.

[code]
cd /home/user
ln -s /var/www/html/userdomain.com www
[/code]

But for some reason, this just doesn’t work with VSFTPD. After fiddling with permissions unsuccessfully for a few minutes, I found a better way.

[code]
cd /home/user
mkdir www
mount –bind /var/www/html/userdomain.com www
[/code]

So you could either do it this way, or use PROFTPD.

 

About Benjamin Perove

Ben has been associated with a broad spectrum of technologies starting from an early age, and he's contributed to the success of many businesses and enterprises since 2001. Most of his time is spent building cool stuff. When he's not working, he enjoys reading, playing acoustic guitar, and being with friends. He currently resides in Chiang Mai, Thailand.

Tunnel Network Traffic Through SSH

ARRR! Happy Talk Like a Pirate day.

In this scenario, we’re going to tunnel network traffic from a remote Windows box through a Linux firewall to the Windows desktop we’re currently using. The firewall of course has SSH enabled and functioning.

Before we establish a connection with PuTTY, we have to add tunnels for the services we want. The source port will be the local port we connect to and the destination will include the private IP and port number.

For example, let’s get connected to VNC (5900) and browse files (139) on our remote computer (10.0.1.20).

Note: In order for file sharing to work properly (obviously we’ve got file sharing turned on and configured on the remote end), we’ll need to stop two local services first. From a command prompt, type:

[code]
net stop “computer browser”
net stop server
[/code]

Next, add the tunnel source/destinations like so:

Save, open the connection and login to the firewall.

The moment of truth! Run \\127.0.0.1\share_name. If all is well, you should be prompted to authenticate and after a short delay, see an Explorer window open with your files.

And to connect to the VNC service running on the remote host, connect like this:

Remember, these sessions are encrypted and tunneled through the Internet, so they’ll be much slower than if you were on the same network. But I think you’ll be pleasantly surprised.

Note: Remote Desktop (port 3389) does not work through a tunnel as Windows cannot connect to the localhost. You could experiment with the Microsoft Loopback adapter or run Terminal Services on alternate ports, but that seems like a real waste of time given that VNC is so easy to setup.

 

About Benjamin Perove

Ben has been associated with a broad spectrum of technologies starting from an early age, and he's contributed to the success of many businesses and enterprises since 2001. Most of his time is spent building cool stuff. When he's not working, he enjoys reading, playing acoustic guitar, and being with friends. He currently resides in Chiang Mai, Thailand.

Perform Basic MySQL Database Operations

Assuming you are a superuser, create a new database:

[code]mysqladmin -p create db_name[/code]

Import data:
[code]mysql -p db_name < db_name.sql[/code]

Dump the db:

[code]mysqldump -p –opt db_name > db_name.sql[/code]

Backup!

Here’s a script called db_backup (make the file executable with chmod a+x filename):

[code]
#!/bin/bash

# vars
path=/backup
suffix=$(date +%m%d%Y)
filename=db_backup_$suffix.tar.gz
db_user=root
db_pass=

# dumb the dbs
mysqldump -u$db_user -p$db_pass –opt asterisk > $path/asterisk.sql
mysqldump -u$db_user -p$db_pass –opt gallery2 > $path/gallery2.sql
mysqldump -u$db_user -p$db_pass –opt wordpress > $path/wordpress.sql

# create an archive, cleanup
tar -P -zcf $path/$filename $path/*.sql
rm -f $path/*.sql

exit 0
[/code]

Edit the crontab with crontab -e and add the following line (which runs every day at 11 pm and logs to the file specified):

[code]
0 23 * * * /backup/db_backup.sh >> /var/log/db_backup.log
[/code]

Alternately you can backup all databases with one command:

[code]
mysqldump –all-databases -p > mysqlbackup.sql
[/code]

Or backup the database files directly from /var/lib/mysql/. You don’t have to be a guru to administer your databases (though some knowledge of relational databases & SQL definitely helps). PHPMyAdmin is a handy tool that you should setup if you haven’t already.

 

About Benjamin Perove

Ben has been associated with a broad spectrum of technologies starting from an early age, and he's contributed to the success of many businesses and enterprises since 2001. Most of his time is spent building cool stuff. When he's not working, he enjoys reading, playing acoustic guitar, and being with friends. He currently resides in Chiang Mai, Thailand.

Troubleshoot IE7 Hanging & Crashing

Does Internet Explorer peg your CPU, rendering your computer useless until you end the process with Task Manager? Or does it crash repeatedly? There’s an easy way to find the culprit. Open Internet Options in the Control Panel. On the Advanced tab, hit the Reset button near the bottom. This will default your browser to its original state.

Chances are good that somewhere along the lines, a plugin or add-on was installed and is the cause for your troubles. Thus, you can enable add-ons one by one again (or not at all) to find the source of the problem. IE is generally stable without 3rd party software, with the exception of apps from Google, Sun, Adobe, etc.

Unfortunately, Microsoft is not regularly developing IE. At this time, only security fixes and bandaids are periodically released. Alternately, you may wish to use a browser that’s lightweight, more fun, standards compliant, significantly more secure (i.e. not vulnerable to ActiveX controls or VB script), and very well respected. Get a real browser. .

 

About Benjamin Perove

Ben has been associated with a broad spectrum of technologies starting from an early age, and he's contributed to the success of many businesses and enterprises since 2001. Most of his time is spent building cool stuff. When he's not working, he enjoys reading, playing acoustic guitar, and being with friends. He currently resides in Chiang Mai, Thailand.

Post-Ride in Aspen

This year’s ride was infinitely better than last year’s. As I recall, it was 55 degrees and rainy which made for a long 100 miles. Not this time. The weather was perfect in comparison–a cold start & first climb, but eventually warming up to 70 with a mellow breeze from the north. AND I beat my PR by over TWO hours. 6:55, baby. Yahoo! That’s an average of about 14.5 mph (which also includes a lunch break).

I wasn’t able to raise as much as last year, which really sucks. I don’t think $1/mile is unreasonable. I was able to raise almost $500, so thanks again to everyone that sponsored me!

I may actually participate in a different ride next time, simply because I dislike asking people (and relatives) for money.

 

About Benjamin Perove

Ben has been associated with a broad spectrum of technologies starting from an early age, and he's contributed to the success of many businesses and enterprises since 2001. Most of his time is spent building cool stuff. When he's not working, he enjoys reading, playing acoustic guitar, and being with friends. He currently resides in Chiang Mai, Thailand.

Add this site to your Firefox Search Bar

Twitter Activity

Recent Entries

Topics

Archives