Pages

Showing posts with label Sys Admin. Show all posts
Showing posts with label Sys Admin. Show all posts

Wednesday, January 20, 2010

Perl Find and Replace One Liner

I'm constantly needing a way to easily change a line in a bunch of configuration files. I thought I'd share the way I do it here.

perl -p -i -e 's/oldstring/newstring/g' *

This allows you to use a regular expression and perform the find and replace.

Wednesday, June 24, 2009

HOWTO: Set the SSHD Idle Timeout

Here's something that I usually forget to change from the default and then get annoyed when my terminal hangs.
  1. As root open your sshd_config file in an editor.
    su -  
    vim /etc/ssh/sshd_config  
    

  2. Add the following lines.
     ClientAliveInterval 600  
     ClientAliveCountMax 3

  3. Restart the sshd process.
     service sshd restart
That's it. That will keep you logged in for 30 minutes at a time without activity. (600 seconds x 3)

Wednesday, March 11, 2009

SVN+SSH Howto: Subversion Quick and Simple

Here's a quick and simple way to create a Subversion repository while maintaining security by using SSH and the filesystem permissions.
  1. Create users and add them to a group. There are a bunch of different ways to do this. I am only showing you how to create a group.
    groupadd svn-users

  2. Make a directory to house the repository.
    mkdir /var/lib/project

  3. Create the repository.
    svnadmin create /var/lib/project

  4. Change permissions to allow the group read/write access.
    cd /var/lib/project
    chgrp svn-users db db/transactions db/write-lock db/revs db/revprops hooks locks
    chmod 2770 db db/transactions db/revs db/revprops
    chmod 660 db/write-lock
    chmod 750 hooks
    chmod 770 locks
You can now have your users access the repository over SSH.

svn+ssh://username@server.example.com/var/lib/project

If your clients are on Windows, I recommend using TortoiseSVN.

Credit goes to the Carnival of Technology.

Thursday, February 21, 2008

Installing Netbackup Enterprise Server 6.5 on CentOS 5 / RHEL 5 withSELinux

It took me almost a whole day to come up with this solution. This should get Veritas Netbackup Enterprise Server 6.5 up and running on a CentOS 5 / RHEL 5 box with SELinux enabled.


HOWTO: Server

  1. Install a couple of dependencies:
    yum install compat-libstdc++-296 xinetd libXp 

  2. Make sure that the hostname is set correctly. This is very important.

  3. Temporarily disable SELinux:
    setenforce 0

  4. Untar the installation files:
    tar xvf NetBackup_6.5_LinuxRedhat2.6.tar.gz
    tar xvf NetBackup_6.5_ICS_LinuxX86.tar.gz

  5. Start the installation:
     ./NB_65_LinuxR_x86_20070723/install
    .....
    #ICS Directory: ./NB_65_ICS_1.4.37.0_LinuxX86/


  6. Fix SELinux:
    chcon -t textrel_shlib_t /usr/openv/lib/*
    setenforce 1


  7. Start Netbackup:
    /etc/init.d/netbackup start

HOWTO: Client

  1. Untar the installation file:
    tar xvf NetBackup_6.5_CLIENTS2.tar.gz

  2. Start the installation:
    NB_65_CLIENTS2_20070723/install

  3. Fix SELinux issues:
    chcon -t textrel_shlib_t /usr/openv/lib/*

  4. Start the client:
    /etc/init.d/nbclient start

Thursday, October 11, 2007

SELinux, Apache, phpMyAdmin, and a Remote MySQL Server

Today I ran into a little problem with phpMyAdmin talking to a remote MySQL server on a CentOS 5 machine. When I would try to connect to the server it would say that the host could not be reached. However, if I used the mysql cli I was able to connect. It turns out that the SELinux policy was prohibiting me from accomplishing this.

To fix this problem you need to modify the policy with the following command.
setsebool -P httpd_can_network_connect=1

This change is instant and persistent, so it will survive a reboot.