安装 NGiNX 时是否应该使用 root 以外的其他用户
我认为使用子用户来安装 NGiNX 会更好。这是真的吗?我正在考虑使用 NGiNX 安装虚拟主机,我的客户可以将其用于该网站,并且我不希望他们对 NGiNX 有太多控制权...
我正在使用 Ubuntu Linux 发行版。
预先感谢您的任何帮助和/或提示。
I herd that it would be better to use a sub-user for installing NGiNX. Is it true? I am thinking to use NGiNX to install virtual-host that my clients could use for there website and I don't want them to have to much control over NGiNX...
I am using Ubuntu Linux distro.
Thanks in advance for any help and/or tips.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不希望进程拥有超出其需要的访问权限。所以,是的,您应该使用除 root 之外的用户——具有读取所需文件所需的最低权限的用户。通常,这涉及专门为该任务创建一个新的 nginx(或 www 或类似)用户。
You don't want a process to have any more access than it needs. So yes, you should use a user besides root -- one that has the minimal privileges required to read the files it needs. Typically this involves creating a new nginx (or www or similar) user specifically for the task.
您打算如何安装这些应用程序?既然您说您使用的是 Ubuntu,那么我假设您将通过图形管理器或通过 apt-get 或 aptitude 安装应用程序。
如果您使用图形程序管理器,那么它应该提示您输入密码;这会在后台执行
sudo
。如果您使用
apt-get
或aptitude
或类似的东西,这些程序需要以root身份运行才能安装。在上述两种情况下,软件包的安装脚本将(应该)处理您要安装的程序正常运行所需的任何与用户相关的问题。例如,当我执行 apt-get install jenkins 时,安装脚本会自动为我创建一个 jenkins 用户,并且我的 Jenkins CI 服务器作为 jenkins 运行 自动用户。
当然,如果您手动编译所有这些程序,那么所有的赌注都会被取消,您需要弄清楚如何最好地自己完成所有这些工作。当然,如果您手动编译这些程序来安装它们,我不得不质疑您为什么要使用 Ubuntu?使用具有健全包管理功能的 Linux 发行版的最佳部分之一实际上是使用所说的包管理! (注意:通过这个声明,我指的是任何基于 Debian 的东西;并且我知道 Red Hat 的
yum
提供了非常相似的功能,但自 2003 年左右以来我就没有使用过 RedHat 的任何东西。)How are you planning to install these applications? Since you say you're using Ubuntu, then I would assume that you'll be installing apps via either the graphical manager or by
apt-get
oraptitude
.If you're using the graphical program manager, then it should prompt you for your password; this performs a
sudo
under the hood.If you're using either
apt-get
oraptitude
or something similar, those programs need to be run as root to install.In both instances above, the installation scripts for the packages will (should) handle any user-related issues that are necessary for the program you're installing to function properly. For example, when I did an
apt-get install jenkins
, the installation scripts automatically created ajenkins
user for me, and my Jenkins CI server runs as thejenkins
user automatically.Of course, if you're compiling all of these programs by hand, all bets are off and you'll need to figure out how best to do all of this yourself. Of course, if you're compiling these programs by hand to get them installed, I'd have to question why you're using Ubuntu in the first place; one of the best parts to using a Linux distribution with sane package management capabilities is actually USING said package management! (Note: by this statement, I mean anything Debian-based for sure; and I understand that Red Hat's
yum
provides very similar capabilities, but I haven't used anything RedHat since around 2003.)