Archive for the ‘Sys Admin’ Category

Perl Find and Replace One Liner

Posted on the January 20th, 2010 under HOWTOs,Sys Admin by jglemza

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.

HOWTO: Set the SSHD Idle Timeout

Posted on the June 24th, 2009 under HOWTOs,Sys Admin,Technology / Computing by jglemza

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)

SVN+SSH Howto: Subversion Quick and Simple

Posted on the March 11th, 2009 under HOWTOs,Sys Admin by jglemza

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.