Server management has never been easier as with Laravel Forge. It literally has everything you need. If you are using supervisor to manage your workers then this tutorial is for you. In today’s blog article we are going to explore how to set up multiple Forge users to have access to supervisor instead of the traditional root user.
Step 1: Connect To Your Server Using SSH
Build a ssh connection to your server by using the credentials listed in Forge.
Step 2: Add Users And A Dedicated Group For Supervisor
Adding multiple users in unix operating system ain’t complicated. Let’s say we wanted to add bob as our new user.
sudo useradd -m bob
sudo passwd bob
Great, now let’s create a dedicated group which we are going to use for our supervisor process and add the desired users to this group.
sudo groupadd supervisor
sudo usermod -a marius -G supervisor
sudo usermod -a bob -G supervisor
Step3: Edit supervisord.conf
Now we need to edit our supervisord.conf on our machine so that every user with the supervisor group can access supervisor.
You can open the config with whatever editor you like:
sudo vim /etc/supervisor/supervisord.conf
Change / add these lines to your config:
chown=marius:supervisor ;socket file uid:gid owner
Save, exit and restart supervisor:
sudo -A systemctl restart supervisor
That’s it! Now every user can have access to supervisor without being required to log in as the root user. This was a quick one and I wish you a nice day! Happy coding!
Managing users and groups:
We have helped 20+ companies in industries like Finance, Transportation, Health, Tourism, Events, Education, Sports.