Run as different user under FreeBSD [closed]

寵の児 提交于 2019-12-03 08:40:15

问题


Is there a way in FreeBSD to (being root) run a command as unprivileged user, like nobody? Kind of like reverse of sudo. Oh and considering that 'nobody' has /usr/sbin/nologin as shell - so su is not an option.


回答1:


sudo will allow you to run a command as another user.

sudo -u nobody <command>

will run as nobody, even if their login shell is not available.




回答2:


You can su to an account with the nologin shell if you use the -m option.

Example:

su -m cthulhu -c '/usr/bin/scorpion-stare'

will run the SCORPION STARE command-line utility as the user cthulhu.



来源:https://stackoverflow.com/questions/285658/run-as-different-user-under-freebsd

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!