How to run a script as root on Mac OS X? [closed]

别说谁变了你拦得住时间么 提交于 2019-12-20 08:48:24

问题


What should I type on the Mac OS X terminal to run a script as root?


回答1:


As in any unix-based environment, you can use the sudo command:

$ sudo script-name

It will ask for your password (your own, not a separate root password).




回答2:


Or you can access root terminal by typing sudo -s




回答3:


In order for sudo to work the way everyone suggest, you need to be in the admin group.




回答4:


sudo ./scriptname




回答5:


sudo ./scriptname

sudo bash will basically switch you over to running a shell as root, although it's probably best to stay as su as little as possible.



来源:https://stackoverflow.com/questions/74829/how-to-run-a-script-as-root-on-mac-os-x

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