Author: Josh

  • Removing memberUid from OpenLDAP group

    The following syntax can be used to remove a user from an OpenLDAP group: $ ldapmodify -x -D “cn=manager,dc=example,dc=com” -W <<EOF > dn: cn=sshusers,ou=groups,dc=example,dc=com > changetype: modify > delete: memberUid > memberUid: previousMember > EOF

  • VIM Control Characters – search and replace

    Control characters require an escape sequence prior to using in a search and replace operation in VIM. In Linux, the escape character is Ctl-v. Windows requires a Ctl-q. Remove all ^M characters from a file on Linux: %s/^V^M//g Remove all ESCAPES (\27, ^[) from a file on Windows: %s/^q^[//g

  • Bash Tip! Renaming files using Bash string operations

    To rename all html files in a particular directory to shtml files, use the following loop: for file in *.html do mv ${file} ${file%%.html}.shtml done This uses the ${variable%%match} format which strips the longest match from the end of the variable.

  • Samba 3.4 Changes idmap backend!

    I recently upgraded some hosts to Fedora 11 which has Samba 3.4 included. I configure most of the hosts I control to be integrated with Active Directory for authentication and this upgrade broke that authentication. The problem was that the winbind daemon was not able to query the LDAP server which was used as the […]

  • error while loading shared libraries: : cannot open shared object file: No such file or directory

    A fairly typical scenario when installing software that does not come fro the distribution package manager is to install an application and find that it cannot find a library necessary to run, although the library is definitely installed.  I recently ran into this issue when compiling spine on an old Debian Sarge system. $ ./spine […]

  • History with time stamps!

    When reviewing the history file in bash, it’s terrible not knowing when a command was executed.  Using the HISTTIMEFORMAT variable in a .bashrc file, the timestamp can be added to all commands. # ~/.bashrc HISTTIMEFORMAT=”%m/%d/%y %I:%M:%S %p ” Sample output: 525  05/21/09 07:56:46 PM tail -f /var/log/messages  /var/log/secure As you can see, the command is […]

  • sudo PATH and bash

    I just spent a bit of time troubleshooting a path issue with sudo on a CentOS server.  This is a note to self to preserve this bit of knowledge. When dealing with sudo, the only time the PATH environment variable will be preserved is if it’s in .bashrc and NOT in .bash_profile.

  • Software RAID and GRUB

    When building out a system with a boot partition using software RAID, it is critical to install GRUB on both drives to that if one fails, the other can be used to boot the system. 1. Make sure that the RAID volume is synchronized (assuming /dev/md0 for /boot): mdadm -D /dev/md0 2. Install grub on […]

  • Persistent Debian Daemons

    As a long time Redhat / Fedora user, starting daemons on system boot in Debian has been a mystery.  I recently took the time to search for the answer, rather than placing the start command in the rc.local file and it’s not that bad.  As long as the init script exists in /etc/init.d, run the […]

  • Replacing a MySQL Master Node

    I recently had to build out a new MySQL node and replace an existing replication master.  Here is the basic procedure that I followed. 1. Build out the new server 2. Install MySQL.  Place the data directory on a logical volume with at least 10% free space in the volume  group (for snapshot backups). 3. […]