Do not run as root

Running the server process as root can be dangerous. If someone discovers a vulnerability in node or in your application code, then they can cause serious damage to the system. It's always a good idea to create a user to run the application server only:

$ sudo useradd -m production

The m option will create a home path located at /home/production, where you can clone the project repo:

$ sudo su - production
$ cd ~
$ git clone https://example.com/path/to/the/project.git
Do not run as root

Figure 9.7 After running node.js process

Get Mastering Backbone.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.