简体   繁体   English

Django生产服务器的Linux用户方案

[英]Linux user scheme for a Django production server

I'm currently trying to set up nginx + uWSGI server for my Django homepage. 我正在尝试为我的Django主页设置nginx + uWSGI服务器。 Some tutorials advice me to create specific UNIX users for certain daemons. 一些教程建议我为某些守护进程创建特定的UNIX用户。 Like nginx user for nginx daemon and so on. nginx用户一样用于nginx守护进程等等。 As I'm new to Linux administration, I thought just to create second user for running all the processes (nginx, uWSGI etc.), but it turned out that I need some --system users for that. 由于我是新来的Linux管理,我以为只是创建运行的所有进程第二用户(nginx的,uWSGI等),但事实证明,我需要一些--system用户对于这一点。

Main question is what users would you set up for nginx + uWSGI server and how to work with them? 主要问题是您为nginx + uWSGI服务器设置的用户以及如何使用它们? Say, I have server with freshly installed Debian Squeeze. 说,我有新安装的Debian Squeeze服务器。

Should I install all the packages, virtual environment and set up all the directories as root user and then create system ones to run the scripts? 我应该安装所有软件包,虚拟环境并以root用户身份设置所有目录,然后创建系统目录来运行脚本吗?

I like having regular users on a system: 我喜欢在系统上拥有常规用户:

  • multiple admins show up in sudo logs -- there's nothing quite like asking a specific person why they made a specific change. 多个管理员显示在sudo日志中 - 没有什么比询问特定人员为何进行特定更改更有用了。

  • not all tasks require admin privileges, but admin-level mistakes can be more costly to repair 并非所有任务都需要管理员权限,但管理员级错误的修复成本可能更高

  • it is easier to manage the ~/.ssh/authorized_keys if each file contains only keys from a specific user -- if you get four or five different users in the file, it's harder to manage. 如果每个文件只包含来自特定用户的密钥, ~/.ssh/authorized_keys容易管理~/.ssh/authorized_keys如果文件中有四个或五个不同的用户,则更难管理。 Small point :) but it is so easy to write cat ~/.ssh/id_rsa.pub | ssh user@remotehost "cat - > ~/.ssh/authorized_keys" 小点:)但是很容易写cat ~/.ssh/id_rsa.pub | ssh user@remotehost "cat - > ~/.ssh/authorized_keys" cat ~/.ssh/id_rsa.pub | ssh user@remotehost "cat - > ~/.ssh/authorized_keys" -- if one must use >> instead, it's precarious. cat ~/.ssh/id_rsa.pub | ssh user@remotehost "cat - > ~/.ssh/authorized_keys" - 如果必须使用>> ,那就不稳定了。 :) :)

But you're right, you can do all your work as root and not bother with regular user accounts. 但是你是对的,你可以以root用户身份完成所有工作,而不必担心常规用户帐户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM