Posts Categorized: linux

pam_exec.so Execute Commands on User Login

In addition to the normal pam_mkhomedir.so I wanted to create a directory for each user on an alternative disk. To do so I edited: vi /etc/pam.d/password-auth added the line below (just above the line: session optional pam_mkhomedir.so) session     optional      pam_exec.so /usr/local/bin/create_dir.sh Then created the create_dir.sh file: vi /usr/local/bin/create_dir.sh and added the following: #!/bin/bash if [… Read more »

Disk Space Usage on Linux

CBS.log Disk Usage Analyzer

An example of narrowing down disk space usage issues on Linux. Starting with the following command: df -h We see that the root volume has 16% space left. Filesystem            Size  Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 129G  103G   20G  84% / cd / We need to run the du command but I wanted to exclude… Read more »

ntopng on CentOS 6

ntopng

Ensure you have the EPEL repository installed first then do the following to add a repository for ntopng: vi /etc/yum.repos.d/ntop.repo Add the following (the deri bit at the end below is not cut off – it works): [ntop] name=ntop packages baseurl=http://rpm.ntop.org/$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://www.nmon.net/centos/RPM-GPG-KEY-deri Install ntopng and dependencies: yum install pfring n2disk nProbe ntopng ntopng-data… Read more »

Installing Munin 2.x on Centos 6

Ensure you have the epel repository installed then: yum install –disablerepo=rpmforge munin-node.noarch munin.noarch The configuration file for Apache is located at: vi /etc/httpd/conf.d/munin.conf Create the username/password file referred to in the above file: htpasswd -cm /etc/munin/munin-htpasswd muninadmin New password: Re-type new password: Restart the munin-node service and ensure it starts on boot: /etc/init.d/munin-node start chkconfig… Read more »

gcp: Copy with a Progress Bar

gcp

I decided to try and use gcp by default in place of the normal cp command so that I would have a progress bar by default. On Ubuntu install gcp with: sudo apt-get install gcp Now to use gcp by default instead of cp: mv /bin/cp /bin/cp-default ln -s /usr/bin/gcp /bin/cp Note: For a recursive… Read more »

Pxeboot CentOS Environment

Organised Chaos

While re-purposing a few old Google Search Appliances I set up a Network Boot Enviornment as follows: Install Dependencies yum install tftp-server tftp syslinux httpd dhcp Configure tftp mkdir /tftpboot vi /etc/xinetd.d/tftp service tftp { socket_type             = dgram protocol                = udp wait                    = yes user                    = root server                  = /usr/sbin/in.tftpd server_args             = -s -v /tftpboot… Read more »

smbclient: Special Characters and UTF-8

I have a PHP web application that communicates to Windows Shares via the smbclient binary. My problem was that some characters (particularly accented characters such as é ) were not being shown on the PHP page and were even causing lines of output to be omitted. After ensuring the PHP page was outputting UTF8 I… Read more »

Media Streaming on Ubuntu with Mediatomb

mediatomb

Install with: sudo apt-get install mediatomb Amend the /etc/mediatomb/config.xml file. I find the  configuration below works well for all the video types I throw at it. Then access the web interface at http://localhost:49152 logging in with mediatomb/mediatomb and add some video directories to be served. <?xml version=”1.0″ encoding=”UTF-8″?> <config version=”2″ xmlns=”http://mediatomb.cc/config/2″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd”><!– Read /usr/share/doc/mediatomb-common/README.gz… Read more »

Exim Troubleshooting

We had a bit of difficulty yesterday with LDAP / Active Directory authentication within Exim. Sending mail via SMTP with authentication was timing out and it looked like a TLS error. 2013-10-01 14:39:12 [17013] TLS error on connection from blahblahblah (ehloname) [192.168.1.3]:52031 I=[192.168.6.51]:587 (SSL_accept): error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol We got to the bottom of the problem… Read more »