Categories
CLI Command Line FTP Linux Windows Windows 2003

Configuring FTP in Isolation Mode in IIS 6

IIS FTP isolation mode enables you to have a separate directory per FTP user. For example if you had a dozen different users that all need access to your FTP server but you did not want them to see any directories but their own you could setup Isolation Mode. Isolation Mode supports users either on the local computer, or if you are a member of a domain it supports domain users.

We will begin by assuming you have FTP (and IIS) installed. Launch IIS Manager (IIS Manager 6.0 in Windows 2008). NOTE: in Windows 2008 make sure you install the IIS Management Console role so you can manage your FTP sites.

  • Delete or disable the default ftp site
  • Create a new FTP site with desired values – at the FTP User Isolation screen select Isolate Users or Isolate Users using Active Directory (which ever works better for your situation)
  • Specify path for your new FTP site
  • Set FTP Site Access Permissions to both Read and Write
Within the root FTP directory you must create either a directory named localuser or <your_domain_name>, depending on which isolation mode you are using.  In my case I am NOT using Active Directory so I created the directory localuser.
Within the localuser or <your_domain_name> directory create the desired user directories and assign each user sufficient permissions to their respective directory.

Example – creating directories:

md ftproot
md ftprootlocaluser
md ftprootlocaluserlocaluser1
md ftprootlocaluserlocaluser2
md ftprootlocaluserlocaluser3

Example – setting Create NTFS permissions on each respective directory:

cacls ftprootlocaluserlocaluser1 /E /G localuser1:C
cacls ftprootlocaluserlocaluser2 /E /G localuser2:C
cacls ftprootlocaluserlocaluser3 /E /G localuser3:C

Categories
Linux tcp ping tcping tcping examples

tcping for Linux

tcping does a TCP connect to the given ip/port combination. The user can specify a timeout in seconds. This is useful in shell scripts running in firewalled environments. Often SYNs are just being dropped by firewalls, thus connection establishment will be retried several times (for minutes) until a TCP timeout is reached. With tcping it is possible to check first if the desired port is reachable and then start connection establishment.

Exit codes:

  • -1: an error occured.
  • 0: port is open
  • 1: port is closed
  • 2: user timeout

Syntax: tcping [-q] [-t timeout_sec] [-u timeout_usec]

  • -q : quiet mode, do not output anything (except error messages)
  • -t : timeout in seconds
  • -u : timeout in microseconds

Download tcping for Linux:

tcping runs under Linux, OpenBSD, Solaris 7/8/9, Solaris 2.6, AIX, and maybe others. Just try.

See also:

Categories
cacti Cacti Examples CactiEZ Linux

Multi-CPU Utilization Graphing in Cacti

The past couple days I’ve been installing and configuring a new version of Cacti (0.8.7c) from a CactiEZ v0.6 installation. I’ve been using Cacti for years now and love what it does, however I’ve found that tweaking it is sometimes problematic.  Since I may go several months or a year or more between tweaking my install I have to rely heavily on the community.  While the Cacti forums are great they often have an overload of information and even out-dated information.

One aspect I’ve tried to get working before in Cacti is multi-CPU graphing, but I’ve never had great success.  Today though I found a great post by Peter at goldfisch.at on the subject – along with some other pretty good gems as well, such as extending Cacti by adding a 5-year graph, configuring Cacti to gather disk I/O and using advanced ping.  He had a great, concise set of steps to download the correct templates (which I’ve done before) and get them working correctly (this is where I’ve had trouble).  I’m going to list those steps with a little tweaking of my own mainly so I have them as a ready reference so somewhere down the road I can do this again, but the credit is all his.  Thanks Peter.

This originates from the Cacti forums post “Multi CPU Utilization Graph” which has links to the templates referenced here.  In fact, you may want to go there to find the latest and greatest on this topic.

Begin by downloading the template(s) you need (these links are all from the thread above which were the most current at the time of this post):

Next, import the template(s) in Cacti (Import Templates under Import/Export on the Console tab).  Before creating graphs for devices using any of these new templates they need to be modified a bit, otherwise they may report incorrect data.  To correct this issue click on Graph Management / CDEFs. You should see Average All data sources – X sources (X depending on your setup and the template(s) you imported).  If for some reason you don’t see these listed type average in the search field and click Go.

In turn click on each of the Average All data sources – X sources and perform the following:

  • Delete the current CDEF items, such as, “Item #1 Custom String: a,b,+,2,/”
  • Add the following three items:
    • Item #1 – Special Data Source: ALL_DATA_SOURCES_NODUPS (AKA “All Data Sources (Don’t Include Duplicates))
    • Item #2 – Custom String: 2/4/8 (depending on X above)
    • Item #3 – Operator: /

Each should like something like this:

Now you can create the graphs for each device.  Click Devices / <Host Name> / create graphs for this host.  Under Graph Templates for the selected host click the drop-down box next to create and select “Host MIB – Multi CPU Utilization on X Processor Box” then click Create. On the next screen you will be asked the Index Type, Index Value and Output Type ID – you don’t need to enter any values, just click Create.  You aren’t done yet – one more important step.

Click Graph Management and locate the graph you just created.  Under Supplemental Graph Template Data select the CPUs you wish to graph in your multi-CPU graph. This is most likely HOSTNAME – CPU Utilization – CPU0 (cpu), HOSTNAME – CPU Utilization – CPU1 (cpu) and so on …

Now that that’s done you should have nice multi-CPU graphs.  You could even delete any previously created CPU utilization graphs, but be careful not to delete the data-sources because the multi-cpu-graph needs these sources.  The multi-CPU graphs will even read data from existing sources.

Cacti multi-CPU utilization graph showing device with two CPUs graphed over the past 24 hours and 7 days:

Cacti multi-CPU utilization graph showing device with eight CPUs graphed over the past month and year:

Categories
cacti Cacti Examples CactiEZ Linux WGET

Upgrade Cacti on CactiEZ Installation

After installing CactiEZ v0.6 (as a VM on Windows 2008 Hyper-V) which includes Cacti 0.8.7c I wanted to upgrade to the latest version of Cacti (0.8.7e as of this post). However I was not able to locate any good directions. Jimmy Conner who put together CactiEZ said to follow the directions for upgrading Cacti in the Cacti manual, but they weren’t exactly easy to follow. So, after mucking through the upgrade I thought I’d put down my notes.  Here they are.

  • Backup the existing Cacti database (I wasn’t too worried about this as I upgraded a new installation):

mysqldump -l --add-drop-table cacti > mysql.cacti

Note: You will probably have to specify the -u and -p flags for the MySQL username and password. This user must have permission to read from Cacti's database or you will end up with an empty backup.

  • Backup the existing Cacti directory (again, since I have a new installation I wasn’t too worried about this).  The root for Cacti in CactiEZ is /var/www/html so I executed all the following commands from the /var/www directory:

mv html cacti_backup

  • Download the latest Cacti tarball (0.8.7e as of this writing):

    wget http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz

  • Extract the Cacti tarball.

tar xzvf cacti-0.8.7e.tar.gz

  • Rename the new Cacti directory to match the old one.

mv cacti-0.8.7e html

  • Edit include/config.php and specify the MySQL user, password and database for your Cacti configuration.

    vi html/include/config.php

    Default CactiEZ include/config.php configuration (vi cacti_backup/include/config.php to view your current config if necessary):

$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “CactiMadeEZ“;

/* Default session name – Session name must contain alpha characters */
$cacti_session_name = “CactiEZ“;

  • Copy the *.rrd files from the old Cacti directory.

cp cacti_backup/rra/* html/rra/

  • Copy any relevant custom scripts from the old Cacti directory. Some script are updated between versions. Therefore, make sure you only over write if the scripts either don’t exist or are newer than the distribution’s.

cp -u cacti_backup/scripts/* html/scripts/

  • Copy any relevant custom resource XML files from the old Cacti directory. Some resource XML files are updated between versions. Therefore, make sure you only over write if the XML files either don’t exist or are newer than the distribution’s.

cp -u -R cacti_backup/resource/* html/resource/

  • Set the appropriate permissions on Cacti’s directories for graph/log generation. You should execute these commands from inside Cacti’s directory to change the permissions.

chown -R cactiuser rra/ log/

(Enter a valid username for cactiuser, this user will also be used in the next step for data gathering.)

  • Finally, point your web browser to:

    http://your-server/

    Follow the on-screen instructions so your database can be updated to the new version.

Wait, there’s more. . .

Now we need to download and install the Cacti Official Patches [0.8.7e].  You may want to check the previous link for the latest. NOTE: download and execute these from /var/www/html which is the default root directory for Cacti on CactiEZ.

wget http://www.cacti.net/downloads/patches/0.8.7e/cli_add_graph.patch
wget http://www.cacti.net/downloads/patches/0.8.7e/snmp_invalid_response.patch
wget http://www.cacti.net/downloads/patches/0.8.7e/template_duplication.patch
wget http://www.cacti.net/downloads/patches/0.8.7e/fix_icmp_on_windows_iis_servers.patch
wget http://www.cacti.net/downloads/patches/0.8.7e/cross_site_fix.patch
patch -p1 -N < cli_add_graph.patch
patch -p1 -N < snmp_invalid_response.patch
patch -p1 -N < template_duplication.patch
patch -p1 -N < fix_icmp_on_windows_iis_servers.patch
patch -p1 -N < cross_site_fix.patch

NOTE: While this upgrade works fine to upgrade Cacti itself you will have to upgrade other CactiEZ components for them to work properly, such as THold, Monitor, Discover, WeatherMap, MACTrack and the Plugin Architecture.  For now you are on your own for those. . .

See Also

Categories
cacti Cacti Examples CactiEZ Linux SSH Ubuntu

Install CactiEZ on Windows 2008 Hyper-V

CactiEZ (Cacti Made Easy) is a self installing Linux Distribution based off CentOS that sets up and configures a customized Cacti install. Everything is designed to be completely automated and working directly out of the box. This compact distro is loaded with extra features such as Syslog and Netflow data collection, Weathermaps, Reports, Auto Discovery, Router Config backup, Nagios, and much more!

This guide provides instructions for installing CactiEZ as a VM on Windows 2008 Hyper-V.

This contains some fairly detailed instructions so someone new to this setup should have enough info to get completely running.  However, since I know some of you out there are in a hurry here’s the Cliff Notes version:
  1. Don’t use the default network adapter – DELETE it!
  2. Add a legacy network adapter.
  3. Install CactiEZ.
Full Instructions for Installing CactiEZ on Windows 2008 Hyper-V
Download the CactiEZ ISO – get this started now so it will be done by the time your’re ready for it.  By default the CactiEZ ISO is a tarred file so you will have to untar (unzip) it before you can use it.  If you don’t already have a Windows-based program that can handle tarred files 7-zip is a great, FREE, utility.  NOTE: in Windows you may have to unzip twice; CactiEZ-v0.6.tar.gz will unzip to CactiEZ-v0.6.tar from which you can extract CactiEZ-v0.6.iso.
Step One: Create the VM on Hyper-V
  • Launch the Windows Hyper-V Manager (Start, All Programs, Administrative Tools, Hyper-V Manager).
  • Select NewVirtual Machine.  Give it a name.  Click Next.
  • Specify memory (RAM).  In this example I’m using 1024 MB.
  • On the “Configure Networking” screen just click Next – we will delete this later anyway.
  • Create a new virtual hard disk using the name, location and size of your choosing.  I created a 10GB virtual HD which should be more than enough for CactiEZ.
  • On the “Installation Options” screen make sure to choose “Install and operating system later.”
  • Click Next, uncheck “Start the virtual machine after it is created” and verify your settings, then click Finish.
    At this point if your VM started you will receive a boot failure message.  Don’t worry, you can safely ignore this and Turn Off the VM.
    Step Two: Customize VM Settings
    • From Hyper-V Manager right-click your new VM, then select Settings.
    • Remove the current Network Adapter.
    • Click Add Hardware and select Legacy Network Adapter, then Add.
    • On the Legacy Network Adapter select the correct adapter from the Network drop-down list
    • Click OK to save settings.
    Step Three: Install CactiEZ
    • Double-click your VM to open the Virtual Machine Connection window.
    • Click Media, DVD Drive, Insert Disk and browse to your (extracted/unzipped) CactiEZ ISO.
    • Start (Power On) the VM & it will begin the CactiEZ server installation.
    • Select whether to install the 32 or 64-bit version and let her rip.  The CactiEZ installation is almost completely automated so just let it run.  When prompted reboot the VM.
    After the system reboots its IP address will be displayed (assuming you have a DHCP server available on the network).  You can certainly change the IP address to a static one if you’d like (instructions below).
    Step Four: Logon to Your CactiEZ Server
    Now that your server is installed logon through the Virtual Machine Connection window.  The default username and password are root, CactiEZ.

    Once logged on the first thing I did was set a static IP address using:

    netconfig

    With the IP address and related settings set appropriately restart the network using:

    service network restart

    You may also want to synchronize your time using:

    ntpdate -u 0.pool.ntp.org

    And set your timezone with:

    yum install system-config-date
    system-config-date

    See more CactiEZ tips and hints here.

    NOTE: By default CactiEZ installs SSH so you can connect remotely with something like PuTTY.
    Step Five: Connect to and Configure Cacti

    Using a browser connect to your new installation of Cacti using http://<IP Address>.  The default user is ‘admin’ and the default password is ‘admin’ as well.  You will be prompted to change the password.

    Now you can knock yourself out configuring and using Cacti.  Here’s more logon information from CactiEZ.

    See also

    Categories
    Apple Linux SSH Ubuntu

    Ubuntu VM on Windows 2008 Hyper-V

    How the Hell do I get networking to work on a Ubuntu VM on Hyper-V in Windows 2008?

    This is a question I have personally grappled with a few times.  Although I was able to successfully install a Ubuntu 8.10 server on Hyper-V with networking over a year ago I forgot how it was done and pulled my hair out trying to figure it out again the other day.  So I thought I’d jot down a few notes to help me remember.  If this  helps anyone else, that will be great too.

    These instructions are for Ubuntu 9.10 server on Windows 2008 Hyper-V.  As mentioned above this works for Ubuntu 8.10 server as well; and presumably other versions although I haven’t verified.

    This contains some fairly detailed instructions so someone new to this setup should have enough info to get completely running.  However, since I know some of you out there are in a hurry here’s the Cliff Notes version:

    1. Don’t use the default network adapter – DELETE it!
    2. Add a legacy network adapter.
    3. Install Ubuntu.
    Full Instructions for Installing Ubuntu 9.10 Server on Windows 2008 Hyper-V

    Download the Ubuntu 9.10 server ISO – get this started now so it will be done by the time your’re ready for it.

    Step One: Create the VM on Hyper-V
    • Launch the Windows Hyper-V Manager (Start, All Programs, Administrative Tools, Hyper-V Manager).
    • Select New, Virtual Machine.  Give it a name.  Click Next.
    • Specify memory (RAM).  In this example I’m using 1024 MB.
    • On the “Configure Networking” screen just click Next – we will delete this later anyway.
    • Create a new virtual hard disk using the name, location and size of your choosing.
    • On the “Installation Options” screen make sure to choose “Install and operating system later.”
    • Click Next, verify your settings, then click Finish.
      At this point if your VM started you will receive a boot failure message.  Don’t worry, you can safely ignore this and Turn Off the VM.

      Step Two: Customize VM Settings

      • From the VM Window click File, Settings.
      • Remove the current Network Adapter.
      • Click Add Hardware and select Legacy Network Adapter, then Add.
      • On the Legacy Network Adapter select the correct adapter from the Network drop-down list
      • Click OK to save settings.
      Step Three: Install Ubuntu
      • Click Media, DVD Drive, Insert Disk and browse to your Ubuntu ISO.
      • Start (Power On) the VM & it will begin the Ubuntu Server installation.
      • Select your Language, then “Install Ubuntu Server.”
      • Select your desired Country and keyboard layout.
      • Enter your desired hostname, then continue.
      • Select your timezone.
      • Partition your disk using the default, “Guided – use entire disk and set up LVM.”
        • Select your disk to partition – if you followed these instructions you will only have one.
        • Select YES to write the changes to disks and configure LVM.
      • Follow the prompts to setup users and passwords, creating at lease one user.
      • Select whether or not to encrypt your home directory.
      • If you have a DHCP server on your network your adapter should retrieve and IP address and associated info from that server.  If not, you will be prompted for IP address settings.
      • Choose how to manage upgrades on your system.
      • Choose which software to install (note, depending on which option(s) you select additional questions will be asked during install which aren’t covered in this tutorial):
        • Cloud computing cluster
        • Cloud computing node
        • DNS server
        • LAMP server
        • Mail server
        • OpenSSH server – You may want to install this to connect via SSH later.
        • PostgreSQL database
        • Print server
        • Samba file server
        • Tomcat Java server
        • Virtual Machine host
        • Manual package selection
      • At the “Finishing Installation” screen select Continue.

      Step Four: Logon to Your Ubuntu Server

      Now that your server is installed logon through the Virtual Machine Connection window to verify network settings and connectivity.  Type ifconfig to view your network settings.  You should have an interface, eth0, with either a DHCP-assigned address or the one you manually entered during installation.

      You could verify correct network operation by pinging a know good host on your local network and/or a host on the Internet.  In my case I pinged my default gateway and powercram.com.  Both responded with replies.

      Finally, now that my Ubuntu Server is setup and networking is configured properly I will probably never (hopefully) use the Virtual Machine Connection window again, rather I will use my favorite remote connection client, PuTTY.

      Since I neglected to install Open-SSH Server during the Ubuntu installation I had to install it before I could use PuTTY using:

      sudo apt-get install openssh-server


      Categories
      Linux Ubuntu

      Recover Root Password In Ubuntu – HowTo

      You can recover/reset/change your root password on Ubuntu if you have physical access to the machine following these simple steps.

      1. Reboot Ubuntu.
      2. At the GRUB menu press ā€˜eā€™ (with quotes), which will let you edit GRUB.
      3. Edit the line with your boot command.
      4. Add this command to the very end of the line with the boot command:
        rw init=/bin/bash
      5. Press enter and boot your system, the command, “rw init=/bin/bash” will make your Ubuntu boot with passwordless root shell.
      6. Once you’re logged on just change your password with the passwd <username> command. If it is root just type: passswd root.
      7. Reboot your system.
      Categories
      Linux Ubuntu

      Change Ubuntu IP Address from DHCP to Static or Vice Versa – HowTo

      The default network setting in Ubuntu (or Debian) is to use DHCP.  Often, however, it is desirable to use a static IP address and settings.  To change your network configuration from DHCP to static follow these steps.

      Open a terminal session and enter:

      sudo nano /etc/network/interfaces

      Two network interfaces should be listed, lo and eth0:

      # This file describes the network interfaces available on your system
      # and how to activate them. For more information, see interfaces(5).

      # The loopback network interface
      auto lo
      iface lo inet loopback

      # The primary network interface
      auto eth0
      iface eth0 inet dhcp

      Change eth0 to your desired settings, such as:

      auto eth0
      iface eth0 inet static
      address 192.168.1.10
      netmask 255.255.255.0
      network 192.168.1.0
      broadcast 192.168.1.255
      gateway 192.168.1.1

      Save the file and close using Ctl+X, Y, Enter.

      Restart the network to apply the new setting, with this command:

      sudo /etc/init.d/networking restart

      Verify your network settings with:

      ifconfig

      See also

      Categories
      Linux

      Windows 7 Mortgage Calculator

      In Windows 7 Microsoft has added new capabilities:  Mortgage Calculator, Fuel economy and Vehicle lease.  To access these features open the Windows calculator then click View, Worksheets, then click the worksheet for the calculation you want.

      Under Select the value you want to calculate, click the variable that you want to calculate, then enter the known values in the text boxes and then click Calculate.  In the following example we are trying to determine the monthly payment so we enter the purchase price, down payment, term and interest rate.

      Don’t forget the result will be the monthly payment amount for the actual loan and doesn’t include insurance or taxes.

      See also Unit Conversion with the Windows 7 Calculator.

      Categories
      Linux

      Unit Conversion with the Windows 7 Calculator

      Besides adding a mortgage calculator, Microsoft has added a number of conversion functions to the new and improved calculator in Windows 7.  You can easily perform conversions between units of power, time, volume, and mass.  Start by opening the Windows 7 Calculator – Start / All Programs / Accessories / Calculator.

      Within Calculator select View, then Unit Conversion. Or, press Ctrl + U.  A unit conversion pane appears to the right of the calculator. Underneath “Select the type of unit you want to convert”, click the pull-down and select your unit type, then in the From field enter the desired value.  Select what you want it converted to and the converted value will be displayed in the To field.

      Windows 7 Calculator Supported Unit Types

      Angle

      • Degree
      • Gradian
      • Radian

      Area

      • Acres
      • Hectares
      • Square centimeter
      • Square feet
      • Square inch
      • Square kilometer
      • Square meters
      • Square mile
      • Square millimeter
      • Square yard

      Energy

      • British Thermal Unit
      • Calorie
      • Electron-volts
      • Foot-pound
      • Joule
      • Kilocalorie
      • Kilojoule

      Length

      • Angstrom
      • Centimeters
      • Chain
      • Fathom
      • Feet
      • Hand
      • Inch
      • Kilometers
      • Link
      • Meter
      • Microns
      • Mile
      • Millimeters
      • Nanometers
      • Nautical miles
      • PICA
      • Rods
      • Span
      • Yard

      Power

      • BTU/minute
      • Foot-pound/minute
      • Horsepower
      • Kilowatt
      • Watt

      Pressure

      • Atmosphere
      • Bar
      • Kilo Pascal
      • Millimeter of mercury
      • Pascal
      • Pound per square inch (PSI)

      Temperature

      • Degrees Celsius
      • Degrees Fahrenheit
      • Kelvin

      Time

      • Day
      • Hour
      • Microsecond
      • Millisecond
      • Minute
      • Second
      • Week

      Velocity

      • Centimeter per second
      • Feet per second
      • Kilometer per hour
      • Knots
      • Mach (at std. atm)
      • Meter per second
      • Miles per hour

      Volume

      • Cubic centimeter
      • Cubic feet
      • Cubic inch
      • Cubic meter
      • Cubic yard
      • Fluid ounce (UK)
      • Fluid ounce (US)
      • Gallon (UK)
      • Gallon (US)
      • Liter
      • Pint (UK)
      • Pint (US)
      • Quart (UK)
      • Quart (US)

      Weight / Mass

      • Carat
      • Centigram
      • Decigram
      • Dekagram
      • Gram
      • Hectogram
      • Kilogram
      • Long ton
      • Milligram
      • Ounce
      • Pound
      • Short ton
      • Stone
      • Tonne