Bashe "HERE documents " help

Discussion in 'Shell Script' started by woodson2, Mar 2, 2012.

  1. woodson2

    woodson2 New Member

    Joined:
    Jun 29, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I'm trying to enter a block of text into an existing configuration file for OpenLDAP so the setup can be fully scripted.

    The text below is what I want to enter into slapd.conf and this all works well and good, however as you probably know this will place the text at the end of the file. What I'd like to know is how can I choose where in an existing file I want to place the text or is this beyond the scope of HERE documents?

    Code:
    cat >> slapd.conf << "EOF"
    access to attrs=userPassword
            by self write
            by anonymous auth
            by dn.base="cn=root,dc=abclott,dc=lott" write
            by group.base="cn=infrastructure,ou=GTECH,ou=groups,dc=abclott,dc=lott" write
            by dn.base="uid=ldapmgr,ou=people,dc=abclott,dc=lott" write
            by * none
    
    access to dn.children="ou=people,dc=abclott,dc=lott"
            by dn.base="cn=root,dc=abclott,dc=lott" write
            by dn.base="cn=bind,dc=abclott,dc=lott" read
            by users read
            by * none
    
    access to dn.children="ou=groups,dc=abclott,dc=lott"
            by dn.base="cn=root,dc=abclott,dc=lott" write
            by dn.base="cn=bind,dc=abclott,dc=lott" read
            by users read
            by * none
    
    access to dn.children="ou=servers,dc=abclott,dc=lott"
            by dn.base="cn=root,dc=abclott,dc=lott" write
            by group.base="cn=infrastructure,ou=GTECH,ou=groups,dc=abclott,dc=lott" write
            by dn.base="cn=bind,dc=abclott,dc=lott" read
            by users read
            by * none
    
    access to dn.subtree="ou=SUDOers,dc=abclott,dc=lott"
            by dn.base="cn=root,dc=abclott,dc=lott" write
            by dn.base="cn=bind,dc=abclott,dc=lott" read
            by users read
            by * none
    
    access to *
            by dn.base="cn=root,dc=abclott,dc=lott" write
            by dn.base="cn=bind,dc=abclott,dc=lott" search
            by * none
    EOF
     
  2. johnBMitchell

    johnBMitchell New Member

    Joined:
    Feb 17, 2011
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    CA, USA
    Home Page:
    http://www.spinxwebdesign.com/
    You can search any file with select or search command and if you want to use that file then use access command. The given coding of access code is really good to understand file system.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice