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