permission error with mydnsimport

Discussion in 'General' started by thewebbie, Feb 6, 2007.

  1. thewebbie

    thewebbie New Member

    When I import a zone using the following command

    mydnsimport --axfr=1.2.3.4 -r domaname.net

    I get the following when trying to view the record.
    Error:
    You don't have the permission to view this record or this record does not exist!

    I have dropped the database and reinstalled everything with the same result. Any ideas?
     
  2. thewebbie

    thewebbie New Member

    ok.. I have figured out that I need to manually edit the tables to get the zones viewable. My next question is.

    1. How can I automate this while importing 10,000 domains?
    2. How can I set permissions when the zone is added by a regular user?
    example.. bob is a reseller and has his own login to add domains. I only want bob and the admin user to view his zones.
     
  3. falko

    falko Super Moderator Howtoforge Staff

    You could write a script (e.g. in PHP) for it.
     
  4. thewebbie

    thewebbie New Member


    If anyone interested. (note.. I am not a programmer nor do I play one on TV) It pulls all the zones and adjusts the data so the zones work after import.

    Code:
    <?php
    $dbhost = 'localhost';
    $dbuser = '*******';
    $dbpass = '*******';
    
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
    
    $dbname = 'mydns';
    mysql_select_db($dbname);
    
    $query  = "SELECT origin FROM soa";
    
    $result = mysql_query($query) or die('Error, query failed');
    
    while($row = mysql_fetch_array($result, MYSQL_NUM))
    {
         $soa = $row[0];
         print "Done with $soa \n"; 
      
        mysql_query("UPDATE soa SET sys_perm_user='riud',sys_perm_group='riud',sys_userid='1',sys_groupid='1' WHERE origin='$soa'") or die(mysql_error());
    
    } 
    
    mysql_close($conn);
    ?>
    
    This one fixes the rr records
    Code:
    <?php
    $dbhost = 'localhost';
    $dbuser = '*******';
    $dbpass = '*******';
    
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
    
    $dbname = 'mydns';
    mysql_select_db($dbname);
    
    $query  = "SELECT id FROM rr";
    
    $result = mysql_query($query) or die('Error, query failed');
    
    while($row = mysql_fetch_array($result, MYSQL_NUM))
    {
         $rr = $row[0];
         print "Record ID $rr \n"; 
        mysql_query("UPDATE rr SET sys_perm_user='riud',sys_perm_group='riud',sys_userid='1',sys_groupid='1' WHERE id='$rr'") or die(mysql_error());
    
    } 
    
    mysql_close($conn);
    ?>
    
     

Share This Page