The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Multiple users, 1 domain

Discussion in 'General Discussion' started by tgavin, Jun 14, 2007.

  1. tgavin

    tgavin Well-Known Member

    Joined:
    Jul 27, 2004
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    There's usually a difference between what I want to do, and what I can do.

    The gist:
    I am developing a web-based application that uses php and mysql. I want to be able to offer 30 day trials. I have one domain that I want to use for this. Each instance of the app requires it's own mysql db.

    What I want to do:
    1. User signs up at form
    2. An account is created for the user
    3. A mysql db is created and populated
    4. The app is copied from a skeleton dir
    5. User is able to login to their admin cp and have at it

    I can write the scripts that handle the installations, copying, etc. I actually have something right now that does all of the above EXCEPT that instead of creating a user account, it creates a dir in the public_html dir of the domain. This works, but it's not as secure as each user having their own account.

    Is there any way that I can write my own php script, or have modernbill (or similar) create an account for each user, all under one domain? Perhaps, user.mydomain.com?
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    You can have subdomains have their own cPanel account just as you would a normal domain. The trick is to simply use "user.mydomain.com" as the domain instead of "mydomain.com" when creating the account.

    Note: this is not the same as creating a sub-domain in the cPanel interface.
     
  3. tgavin

    tgavin Well-Known Member

    Joined:
    Jul 27, 2004
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    Thank you.

    I've tried this and the domain doesn't show in my browser - "Can't find the server..."

    Does this server need to be it's own DNS server for this to work?
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Did you wait 72 hours for the DNS to propagate?

    It shouldn't matter if you are using cPanel DNS Clustering or not. If you are not letting cPanel/WHM or cPanel DNS-Only handle your DNS, be sure to create the appropriate DNS records manually.
     
  5. tgavin

    tgavin Well-Known Member

    Joined:
    Jul 27, 2004
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    Unfortunately, browser access needs to be immediate. If I were to use the server as a DNS server, wouldn't the account be accessible immediately?

    Or, am I better off just creating a directory for the user as previously stated? It's not as secure, but it is immediate.

    Thanks again :)
     
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    DNS is never instantaneous. If you are trying to do anything with creating domains or sub-domains, you are going to need to let the DNS propagate before the user can access that.

    If you need things to be instantaneous, you would need to have the content hosted on a domain/sub-domain whose DNS has already propagated (such as your existing setup).

    Perhaps instead of creating a full-fledged cPanel user, you may want to consider creating an additional FTP user that only has access to their particular directory instead of all directories on the cPanel account.
     
  7. tgavin

    tgavin Well-Known Member

    Joined:
    Jul 27, 2004
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    Yes. This domain has been around for a week or so. It's propagated. Of course, any sub-domain created will be new.

    What I'll be installing is control panel-based, so I'm actually disabling all ftp access for the domain (plus using a 16 character password for the main/domain account!). After the user creates his account, a php script will create a mysql db and populate it, plus grant access to that user for that db. Then it will copy a series of files from a skeleton dir. After all is said and done, the user will login at www.domain.com/user/admin. The admin section is protected by u/p and php sessions. So, in theory any malicious activity *should* be stifled.

    If I could do that with more security, that would be great - especially where mysql is concerned. That's why I was looking into full-fledged user accounts. I like the idea a user.domain.com. But, domain.com/user is just as good.
     
Loading...

Share This Page