Archive for the ‘Microsoft Windows’ Category

Testing, troubleshooting POP3 connectivity & authentication

August 3, 2010

Method 1: Python

$python
>>> from poplib import *
>>> mail = POP3("hostname-or-IP")
>>> mail.user("user-name")
>>> mail.pass_("password")

Method 2: Netcat

Linux users already have netcat aka nc. For Windows users I recommend snetcat, which supplies a pre-compiled Windows binary.

$nc <hostname-or-IP> pop3
USER <user-name>
PASS <password>

To retrieve messages

RETR 1

Related Posts

Simple Python-based IMAP4 command-line scripting tool

“USN rollback comes back with a vengeance when Domain Controllers are restored using snapshots.”

July 31, 2010

In the world of virtualization good admins make snapshots of VM’s before making significant changes, right?  Great idea except you need to be careful, because if you roll back a Microsoft Windows Domain Controller you could put yourself in a world of hurt.  Here is an excellent article from Windows IT Pro magazine written by Greg Shields explaining why you should never rollback a snapshot of a Domain Controller.

How-to setup Ubuntu Server Active Directory integration

July 28, 2010

Quick & Easy Method

Install Likewise-Open 6.x

Find link for the most current DEB Likewise-Open version 6.x at http://www.likewise.com/community/index.php/download and then download the package (32-bit or 64-bit)from sfx. Example: 

wget http://www.likewise.com/bits/6.0/8234/LikewiseOpen-6.0.0.8234-linux-amd64-deb.sh
sudo ./LikewiseOpen-6.0.0.8234-linux-amd64-deb.sh 

Join the computer to the domain

Note: In the command listed below replace the your-domain-name & your-Administrator-account-name with appropriate information.  You may also use any other privileged account rather than the Administrator account to join the computer to the domain.

sudo domainjoin-cli join your-domain-name your-Administrator-account-name

At the prompt, enter the domain administrator password.   

 Test authentication with domain account

su your-domain-name\\your-Administrator-account-name

Enter the password for the Domain Administrator account at the prompt.    

Configure SSH for Domain Authentication

Edit the SSH config file (replace jed with your favorite editor): 

sudo jed /etc/ssh/sshd_config

Find the Authentication section. You will find a list of names in this field. Add a * (asterisk) to the end.   

Example: 

Allowusers *

Close and save the config file.   

Restart the SSH daemon

sudo /etc/init.d/ssh restart

SSH authentication with domain credentials

ssh your-domain-name\\your-Administrator-account-name@localhost

Add Domain Admins to the Sudoers File

Edit the sudoers file: 

sudo jed /etc/sudoers

Add the following line to the end of the file:  

%your-domain-name\\domain^admins ALL=(ALL) ALL

Save and close the file.  

Usage

To use a domain account to SSH in to the computer, use the following example:  

 login as: your-domain-name\your-AD-account-username

Note: In a Unix shell, a \ (backslash) character is used as an escape key. When referring to a domain account while in a bash shell, use two backslashes. (SSH login prompt only requires one backslash)  

Example:   

su your-domain-name\\Administrator  

Active Directory Groups

You can now use AD accounts in chown & AD groups in chgrp to assign permissions to directories and files just like you would with local Linux users & groups. For example to see your AD groups type the following:

groups

References

Credits

Special thanks to Jeremy Dye for providing the information used in this post.

Searching & replacing non-printable characters in text files (i.e. null characters)

June 20, 2010

How-to display a summary of non-printable characters in a text file

The non_printables Python module will display each unique ASCII decimal value, the number of times it occurred in the file, the character that was found, and the ASCII octal value of the character. The module was written for comfort and not for speed, so it can take a minute or two to process large text files, but I think it is definitely worth the wait…

cat sample.txt|./non_printables.py
  ------------------------------------
 | ASCII  | # Times  | Char  | Octal  |
  ------------------------------------
 | 0      | 9773449  |       | 000    |
  ------------------------------------
 | 164    | 1        | ñ     | 244    |
  ------------------------------------
 | 189    | 10       | ╜     | 275    |
  ------------------------------------
 | 170    | 2        | ¬     | 252    |
  ------------------------------------
 | 221    | 2        | ▌     | 335    |
  ------------------------------------
 | 159    | 255      | ƒ     | 237    |
  ------------------------------------

Replacement of non-printables

The Unix ‘tr’ command replaces characters in large text files with blazing speed.  By the way, just because it is a Unix command doesn’t mean you can’t use the ‘tr’ command  in Windows, see my UnxUtils post for further information.  Here is an example of the ‘tr’ command syntax…

cat sample.txt|tr '\244' '\040'|tr '\000' '\040' > result.txt

(more…)

High-quality, fast, light-weight Windows & Unix text editors

June 14, 2010

When someone recommends text editors I usually yawn — everyone’s got their own flavor, and I’ve already picked mine out. So why am I posting about text editors? Because there is a text editor that’s so well written, and that I have enjoyed using so much that I wanted to share it as a thank you to the author Florian Balmer.

Notepad2 is a lightweight drop-in replacement for Window’s Notepad, if you haven’t tried it please give it a whirl; seriously this is a quality program. Normally the terms feature-packed and lightweight are oxymorons, but not with Notepad2. It’s incredibly intuitive; the menu items and keyboard short-cuts are exactly where your brain tells you they should be.  Packed to hilt with features, but not overwhelming, it just feels like you’re using Notepad on steroids. Enough talk, just try it… Notepad2

Notes: I prefer the Notepad2 version with code-folding, it comes in both 32-bit & 64-bit versions.  I typically toggle code-folding off and just turn it on whenever needed.

And while on the topic of text editors… how about Unix text editors?

Obviously I think Notepad2 shines in the Windows world, however, in the Unix realm I don’t try to push any one editor, use whatever works for you. For example I’m an emacs guy, but if someone is coming from the Windows world and getting their feet wet in Linux, I’d prefer they spend their time learning the OS instead of wrestling with emacs or vi; forcing them to learn alien key-strokes at the same time seems like a form of sadism.  In these cases a Windows-style editor such as pico would be a better choice.  However, in the long-term, it is good to eventually take the time to learn emacs or vi as they are the de-facto Unix editors, and they become amazingly easy to use with practice. You’ll also find a subset of emacs editing key combinations supported in other places, i.e. Cisco IOS, Python Cmd module, etc. For emacs I personally prefer jed over full-blown emacs, jed is not so bloated; very fast, lightweight and portable.   But that’s just my preference, use whatever best fits your style.

And here’s to wishing you a happy editing experience :-)

How-to create a request, install & bind a 3rd party SSL certificate on Windows Server 2008 Server Core

May 29, 2010

How-to create a request, install & bind a 3rd party SSL certificate on Windows Server 2008 Server Core

Purpose: The aim of this document is to provide step by step procedures on creating a certificate request, installing and binding a 3rd party SSL certificate on a Windows Server 2008 Server Core installation system. This document assumes that you have already installed IIS 7.0 and enabled IIS Remote Management.

Requirements

  • IIS Manager
  • IIS Management Console
  • Remote Desktop
  • SSL Certificate

3rd party SSL certificate installation and binding on Windows 2008 Server Core

This post is courtesy of Jorge Ovando Zalapa.

Fast, light-weight Unix utilities for Windows

May 22, 2010

Here are some ports of common GNU utilities to native Windows;  the package is really fast, lightweight and unobtrusive.  UnxUtils is available at Sourceforge, but I prefer the package at http://bit.ly/aduz5O because it automatically takes care of setting up the environment variables - just launch the wizard, select the defaults and off you go . The site I linked to claims that it is not maintainined anymore, don’t worry the tools are stable,  I’ve used these same UnxUtils  on countless workstations for over 6 years.  I have to warn you though, if you’re anything like me, once you get used to these tools you’ll be spoiled and you’ll feel totally crippled in Windows without them.  Fortunately they are small in size,  so you can easily keep a copy of them on your thumb drive.

(more…)

Opsview Agent Installation for Windows Server & Server Core

May 7, 2010

(more…)

How-To make a Certificate Request in Windows 2008 R2 Server Core

May 6, 2010

Credit for the following answer goes to my sys/network admin John Kauffman and to Experts-Exchange guru Paranormastic:

certreq -new c:\temp\request.inf c:\temp\certrequest.txt
certutil -f -addstore My c:\temp\certname.cer

If you have problems, you may need to reassociate the private key. Try this:
certutil -dump certname.cer | more
(search for “Serial Number” and substitute below)

certutil -repairstore My %SerialNumber%
certutil -store My %SerialNumber%

Reference: How to make a Certificate Request on a Windows Server Core VM 
(link requires an Experts-Exchange account)

Related Links

Installing & Binding 3rd party SSL certificates on Windows 2008 Server Core

How-To Set Default Printers by Computer OU when Deploying Printers via Windows 2008 Group Policies

May 6, 2010

If you’re in an organization running Microsoft Window 2008 servers, there’s a good chance you are deploying printers via group policies.  It’s awesome, life is great expect for one thing – those pesky default printers.  Only if you could set all the default printers based on computer OU’s… fortunately there’s a solution,  check out this great article:
Setting Default Printers with Windows 2008 Server Group Policy Preferences
Setting Default Printers with GPP Using Loopback Processing


Follow

Get every new post delivered to your Inbox.