Likewise Open makes it very easy to authenticate users on a Linux machine using Windows Active Directory Domain Services and in today’s mixed Operating System environments it is possible to integrate assorted services across your network.
Once upon a time I was 100% Linux but got frustrated with the ever complicated setup of LDAP for authenticating a few users on my network. I now use Citrix XenServer to host a mixture of Windows and Linux virtual machines and found Windows Server 2008 Active Directory Domain Services to be a good replacement for other authentication services (as a Linux fanboy, that statement was hard to admit for some time).
Here follows a short list of useful tips for using Likewise Open:
-
Windows DNS Server
Make use of the Windows DNS Server by using its IP and domain within your
/etc/resolv.confor assigning it within your DHCP service.# /etc/resolv.conf # replace yourdomain.tld with your Active Directory domain # replace XXX.XXX.XXX.XXX with your Windows Servers IP address domain yourdomain.tld search yourdomain.tld nameserver XXX.XXX.XXX.XXX
This makes it easier to use
domainjoin-cliordomainjoin-guito get your Linux machine connected to the Active Directory. -
Username Formatting and Location of Home Directories
When logging into your Linux desktop, make sure you use the format
YOURDOMAIN\usernamebut if you are logging into a shell, remember to escape the backslash with another backslash asYOURDOMAIN\\username.
Also Make note that not only uid/gid are different but also the location of home directories (/home/YOURDOMAIN/usernameor/home/local/YOURDOMAIN/username, although this can be changed). -
POSIX Friendly Groups

Do feel the need to create a group for any users you add to the active directory, for example:
I am user ‘martin’ and my Primary Group is ‘martin-group’.
Doing this is more POSIX friendly and enables you to still have a very secure Linux system when your home directory is chmodrwxrwx---and chownYOURDOMAIN\\username:YOURDOMAIN\\username-group. -
Do Things as root
Missing sudo access?
Make sure you are a member of ‘Domain Admins’ within the Active Directory and add the group to your /etc/sudoers file:# replace YOURDOMAIN with your Active Directory domain %YOURDOMAIN\\domain^admins ALL=(ALL) ALL
Notice that the backslash is escaped with a backslash, Domain Admins is lower-case and space has been replaced with a ‘^’.
This could also be done by creating a ‘sudo’ group in the active directory, assigning users and adding%YOURDOMAIN\\sudo ALL=(ALL) ALL.
Referenced from ‘Ubuntu Forums – Re: Likewise-Open User with Sudo permissions?‘ -
Avoid Local Password Errors
Changing local passwords results in ‘Authentication token manipulation error’!
I have only tested this in Ubuntu so far and found out that it should be fixed in Ubuntu Lucid (Bug #302026).
For me (On Jaunty), the following fixed the issue:sudo apt-get install libpam-cracklib
-
Use a Samba Server
I did not get on too well with Windows NFS server or Windows File Sharing for Linux clients, a few days of messing about sent me running back to Linux for a solution.
I decided to use CentOS for my file server and combine NFS and Samba for both Windows and Linux clients.
Using this method allows Linux client machines to mount the home directory via NFS as normal (and already well documented) and other windows client users will automatically connect the share via Samba onto the specified device.
For CentOS, I followed reply #3 in the ‘CentOS forums – Setting up a folder share using Likewise over an Active Directory Network‘ so that Samba played nicely with Active Directory and then I added the following to/etc/samba/smb.conf.# replace YOURDOMAIN with your Active Directory domain [Users] path = /home/local/YOURDOMAIN writeable = yes browseable = yes guest ok = yes create mask = 0660 directory mask = 0770 admin users = YOURDOMAIN\administrator
Then you can simply edit your users profile within Active Domain to automatically map
Z:to use\\CENTOS\Users\usernamewhenever and wherever they log on and for Linux users, just use NFS (NOTE: YOURDOMAIN\Administrator will still get access to all the home directories in the Samba share, but I am still unsure how to make this play nicely when you install software as a user with ‘Domain Admins’ privileges on a Windows machine when the install wants to useZ:\WINDOWS).
If you have something to add or you feel I have missed some elegant tip out, please leave a your thoughts in the comment section below!










Using the WordPress database class within your own scripts
Every now and again you want to write a simple PHP script, either for use in real cron or maybe for your ajax requests that uses your existing WordPress tables without having to load or even partially load the WordPress core.
There are a multitude of ways to achieve this and one method I have used in the past requires the use of ezSQL which is in fact what the WordPress database class is based on.
Chances are that if you have WordPress installed, there is no reason you cannot make use of its wp-db.php and wpdb class without loading in a large portion of the WordPress core.
// If we want to be like WordPress, we must set a few things so edit these as required // MySQL settings - copied from your wp-config.php define('DB_NAME', 'db_name'); // The name of the database define('DB_USER', 'db_user'); // Your MySQL username define('DB_PASSWORD', 'db_passwd'); // ...and password define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); $table_prefix = 'wp_'; // Only numbers, letters, and underscores please! // Set this to a particular blog ID if you use WordPressMU or MultiSite $blog_id = false; // ABSPATH is useful to use within our own code for the path to WordPress, do not forget the trailing slash! define('ABSPATH', '/home/mysite/public_html/'); // WPINC is also useful to set define('WPINC', 'wp-includes'); // Done editing - but feel free to make changes below // Fix for WP3.0, it is safe to leave this in for other versions function is_multisite() { if ($blog_id) { return true; } else { return false; } } // Stop the automatic creation of the $wpdb object $wpdb = true; // Here comes ezSQL - ahem - wpdb from WordPress require_once(ABSPATH . WPINC . '/wp-db.php'); // Create a new wpdb object $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST ); // Either comment this out or set to null if you are using a stand alone WordPress install if ($blog_id) $wpdb->blogid = $blog_id; // now we need to setup the table prefix so wpdb can reference tables // i.e $wpdb->postmeta $wpdb->set_prefix($table_prefix);Now you can use the $wpdb object in your stand alone scripts. If I have missed anything out, please feel to leave me a comment.