1

I am trying to automate user creation or adding of users to my squirrelmail server i have configured on ubuntu 16.0.4. I want to create a registration form using php then i want to the user it self to register him self to the mail server which is squirrelmail. simply like gmail when you first signup you should have to register your self . that is exactly what i want to develop.

when adding users into squirrelmail you have to run these commands on ubuntu

$ sudo useradd myusername
$ sudo passwd myusername
$ sudo mkdir -p /var/www/html/myusername
$ usermod -m -d /var/www/html/myusername myusername
$ sudo chown -R myusername:myusername /var/www/html/myusername

what i exactly want is to excute these commands from php script by accepting username and password from the user. Is there any way i can do these...please help me??

Olana Kenea
  • 39
  • 2
  • 11

2 Answers2

0

you can queue this users to redis or write in file , and write shell script that read this users from file or redis and execute these commands for each user , and then add cronjob in ubuntu that execute every second ( for root user ) to run that shell script

parisam
  • 26
  • 2
0

SquirrelMail is not a mail server. It's an email client, just like Outlook or Thunderbird or any other webmail client. Creating an email account is outside the scope of a mail client and is greatly dependent on how your email server is set up.

That said, SquirrelMail does have a plugin called Vadmin that can be configured to interface with your mail server and manage the email accounts therein -- just note that you need a detailed understanding of your system to be able to configure the plugin correctly. Also note that it allows you to manage accounts only after logging in as an administrator. If you want a public-facing user signup page, most of the time that is something you want to custom-build... and while you can run the commands you've found from inside a PHP script, doing so is generally A Very Bad Idea(tm) at least without a lot of security measures in place (your webserver/PHP won't even be able to run those sudo commands out of the box anyway, which is a good thing). That's where parisam's answer becomes one possible route to take but be careful putting this on a public-facing web page without abuse-prevention measures in place.