Welcome to MJ12Net.org
About Us PDF Print E-mail
Written by Administrator   
Thursday, 12 March 2009 05:53

 Perl Code

 

MJ12Net is a site that I use as a repository for all of my notes. Whenever I learn something new I'll post it here. I create scripts to help me automate things that would otherwise have to be done manually. I'm learning some really cool stuff so I will take time throughout my day from now on to update the site just like a wiki. Thanks for stopping by everybody.My Statcounter tells me you guys come here from all over the world.

I get most of my traffic from the United States, India, Germany, the United Kingdom, and Canada in that order. I get people from all over the world. By far my most popular page is the System Administrator Interview Cheat Sheet. I am sorry to say that it is starting to get out of date. But it still has some handy stuff on it. If any of you guys are like me and want to chat please drop me a line.

 

Thanks All,

Brian

Last Updated on Friday, 23 October 2009 19:37
 
Setup Samba Fedora 11 PDF Print E-mail
Written by samba-fedora-11   
Tuesday, 27 October 2009 08:01
  1. yum install samba samba-client libtalloc
  2. cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
  3. vi /etc/samba/smb.conf
  4. [global]
    ; Uncomment this if you want a guest account
    ; guest account = nobody
    workgroup = MJ12NET
    log file = /var/log/samba-log.%m
    lock directory = /var/lock/samba
    share modes = yes

    [homes]
    comment = Home Directories
    browseable = no
    writable = yes

    [tmp]
    comment = Temporary file space
    path = /tmp
    read only = no
    public = yes
  5. vi open-firewall-samba.sh
  6. #!/bin/bash
    SAMBA_SERVER="192.168.10.104 "
    NETWORK="192.168.10.0/24"
    # Local area network
    BROADCAST="192.168.10.255"
    # Local area network Broadcast Address
    iptables -A INPUT -i lo -j ACCEPT
    iptables -A OUTPUT -o lo -j ACCEPT
    iptables -A INPUT -p udp -s $NETWORK \
    -d $SAMBA_SERVER -m multiport --dports \
    137,138 -j ACCEPT
    iptables -A INPUT -p tcp -s $NETWORK \
    -d $SAMBA_SERVER -m multiport \
    --dports 139,445 -j ACCEPT
    iptables -A INPUT -p udp -s $NETWORK \
    -d $BROADCAST --dport 137 -j ACCEPT
    iptables -A INPUT -p udp -d \
    $SAMBA_SERVER -m multiport \
    --dports 137,138 -j DROP
    iptables -A INPUT -p tcp \
    -d $SAMBA_SERVER -m multiport \
    --dports 139,445 -j DROP
    iptables -A OUTPUT -s $SAMBA_SERVER \
    -d $NETWORK -m state --state \
    ESTABLISHED,RELATED -j ACCEPT
  7. chmod +x open-firewall-samba.sh
  8. ./open-firewall-samba.sh
  9. service iptables restart
  10. useradd samba
  11. passwd samba
  12. smbpasswd -a samba
  13. chkconfig nmb on
  14. chkconfig smb on
  15. service nmb start
  16. service smb start
Last Updated on Thursday, 29 October 2009 02:31
 
Notes For SysAdmins PDF Print E-mail
Written by notes-for-sysadmins   
Thursday, 22 October 2009 18:00

  • Script to import latest ldif

=====================
////////////////////
=====================
#!/bin/bash
set -e
host= uname -n
read -s -p "Enter Password: " mypassword
ldapsearch -x -h ldap-vip -D cn=admin,dc=netflix, \
dc=net -w $mypasswd -LL > latest.ldif
service ldap stop
date=`date +%Y%m%d`
mv /var/lib/ldap /var/lib/ldap.$date
mkdir -p /var/lib/ldap
chown ldap /var/lib/ldap
ldapadd -x -h $host -D cn=admin, dc=netflix, \
dc=net -w $mypasswd < latest.ldif
service ldap start
exit

  • Tar and Save Home Dirs

==============
///////////////
===============

#!/usr/bin/perl

@namelist = qw(bmcarthy dwells emertz lkilgore \
dhyman jbecker blo arendich smclendon nsavage koss \
sswasey benderwick nrothstein twillerer mstern \
poeschger tsarandos slee pkirincich jmeir lbritton \
mlowe eziegler);
foreach $name (@namelist) {
system("tar cvf - ./$name | gzip -c > ./$name.tar.gz");
}
exit;



  • changeip of lpar
Last Updated on Saturday, 06 November 2010 00:23
Read more...
 

Founder MJ12Net

Founder MJ12Net.org

Brian Bills
Founder MJ12Net
System Admin

Stumble Us

Who's Online

We have 5 guests online
Valid XHTML & CSS | Template Design ah-68 | Copyright © 2009 by Firma