简体   繁体   English

以另一个用户(root用户以外的其他用户)身份运行整个应用程序

[英]Run whole application as another user (other user than root)

https://github.com/mongodb/mongo/blob/master/debian/mongodb-org-server.postinst I could see in the above link that mongodb has created a newuser named 'mongodb'.and I got to know that many bigger projects run their project as a custom user (here as a user 'mongodb').I wrote a small application in python and running it as sudo right now,I would like to create a new custom user for my application and run the application as the custom user.how does actually bigger projects acheive this .what is the command they use to make run the whole application or package as a custom user? https://github.com/mongodb/mongo/blob/master/debian/mongodb-org-server.postinst我可以在上面的链接中看到mongodb创建了一个名为“ mongodb”的新用户。我知道很多较大的项目以自定义用户(此处为用户“ mongodb”)的身份运行他们的项目。我用python编写了一个小应用程序,现在以sudo方式运行,我想为我的应用程序创建一个新的自定义用户并运行该应用程序作为自定义用户。更大的项目实际上是如何实现的。他们使用什么命令以自定义用户身份运行整个应用程序或程序包? In a whole lot reading about this I found that we could use sudo -u <username> <command> or by setting euid or uid by seteuid() function. 通过大量阅读,我发现我们可以使用sudo -u <username> <command>或通过seteuid()函数设置euid或uid。 but I want to know how actually real projects implement it and follow that standard way in my project. 但我想知道实际的项目是如何实现它的,并在我的项目中遵循该标准方法。

就像您链接的文件一样,他们使用chown将可执行文件的所有者更改为自定义chown因此您可以在安装后脚本中使用该脚本(该脚本将配置应用程序正常运行所需的内容)

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

相关问题 将Linux应用程序作为除root之外的其他用户运行 - Running Linux application as another user other than root MongoDB,不是root用户的Ubuntu用户,并将PID文件存储在/ var / run / mongodb中 - MongoDB, an Ubuntu user other than root, and storing the PID file in /var/run/mongodb 致命:不是 root 以外的用户的 git 存储库(或任何父目录) - fatal: Not a git repository (or any of the parent directories) for user other than root 我可以以与 root 不同的用户身份运行 cloud init 吗? - Can I run cloud init as a different user than root? 安装NGiNX时,我是否应该使用除root以外的其他用户 - Should I use another user than the root when installing NGiNX 以 root 用户身份运行弹性搜索 - Run elastic search as root user 检查用户是否是java应用程序中的root用户 - Check if a user is root in a java application 如何使用服务器上的其他用户运行 Rails 应用程序? - How to run a Rails application using other user on the server? 编写运行其他用户拥有的另一个Shell脚本的Shell脚本 - Writing a shell script that run another shell script owned by other user 用root以外的用户启动Docker守护程序时出错(权限被拒绝) - Error when starting Docker daemon with user other than root (permission denied)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM