Why not use root users to run lnmp

most of the time, the lnmp in the online environment does not use root to run. For example, nginx creates a single user, and mysql creates a single user. Code files and even nobody users. I don"t quite understand, and there is no relevant explanation on the Internet, just tell you why? Is there a big god to explain?!

Mar.22,2021

Security considerations. You will find that almost all Linux services run without root identity, and very few services require root identity.

imagine that if your php program runs using root, in case your program has a loophole and gets web shell, then the hacker will directly have root access to your system. Think about what a terrible thing it is. So you will find that almost all the exposed services in Linux do not use root.

for programs like Nginx,Apache that need bind ports, they use root to run processes, bind ports, and fork processes to provide services under low-privilege accounts (such as Nginx). If you take a closer look at Nginx's process tree, you will find


each performs his or her own duties. For example, does one of your company's minions know the company's financial information? Do you really need to know? Will the boss let you know?


for security.
that's why unix,linux, even windows, has different user rights.


originally used root users, but later there were loopholes through which people can view the contents of your entire server and destroy and delete them.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea2b9b-1bfd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea2b9b-1bfd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?