Webmin user add/modify

Webmin
2007-02-12
2013-05-21
  • Phani Chavali

    Phani Chavali - 2007-02-12

    Hi

    I am facing the following situation:

    The root account on the RH linux box is frozen. But I can still install webmin rpm using another account. I do not want to thaw the root account permanently (though I can do it temporarily). Is there a way to add users to webmin from the command line and configure the modules that they can access (remember I need this to be done from the command line).

    Any help will be appreciated.

    Thanks
    PC

     
    • HiDef-Laws

      HiDef-Laws - 2007-02-16

      You could script the process or do the lines manually, I suppose.  You'll need to edit the following file to create users (and their passwords) for webmin alone.  I still believe you may need root access, although you can create a webmin user to do these things with root priviledges.

      miniserv.users

      # Creates Webmin user and junk password
      cp /etc/webmin/miniserv.users /etc/webmin/miniserv.users.bak
      echo "$USERNAME:$1$11111111111111111110:0:::" >> /etc/webmin/miniserv.users

      # Changes Webmin user password from junk to what they reall want, then shadows it
      /usr/libexec/webmin/changepass.pl /etc/webmin $USERNAME $PASSWORD

      Something like this could do it, however it is not encrypting the password.  It is making a junk password and then using the webmin changepass perl script to overwrite the junk w/ the true password.  You could always throw in a crypto section ahead of that to encrypt the password prior to writing it to miniserver.users ($PASSWORD = the password you want, $CRYPT_PASSWORD *obviously* is the encrypted version):

      # Encrypt our users password
      ./cryptext.pl $PASSWORD

      # Get the encrypted version back from file
      exec 6<&0       # Save stdin
      exec < holdingfile.dat
      read CRYPT_PASSWORD
      echo "Encrypted pass: $CRYPT_PASSWORD"
      PASSWORD=$CRYPT_PASSWORD
      echo "PASSWORD: $PASSWORD"
      echo; echo
      exec 0<&6 6<&-  # Restore stdin

      As far as the modules and all of that, that all deals with the webmin.cats, webmin.acl and adding the customized commands to the cloned module like:

      # webmin
      #
      #
      #copy cp template - libexec part
      #
      cd /usr/libexec/webmin
      ln -s $MODULEMASTER $USERNAME

      #
      # add new clan server to webmin.cats
      #
      cd /etc/webmin
      cp -f  webmin.cats webmin.cats.bak
      echo "$USERNAME"=servers >> /etc/webmin/webmin.cats

      #
      # add new clan to webmin.acl
      #
      cd /etc/webmin
      cp -f webmin.acl webmin.acl.bak
      rm -f webmin.acl
      cat /etc/webmin/webmin.acl.bak | sed "s/root:/root: "$USERNAME" /" > /etc/webmin/webmin.acl
      echo "$USERNAME": "$USERNAME" $MODULENAME  >> /etc/webmin/webmin.acl

      #
      # copy hd template in webmin directory
      #
      cd /etc/webmin
      cp -rf $MODULENAME $USERNAME
      cd $USERNAME

      # copy client's customized module acl
      #
      cp /usr/local/.../$MODULE.acl /etc/webmin/$MODULENAME/$USERNAME.acl

      cd /etc/webmin
      #
      # add clone to new server directory
      #

      echo desc="$USERNAME" blahblah Control Panel >> /etc/webmin/$USERNAME/clone

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks