Recently, Mac OS BIG SUR is made when the U disk is installed, appearsThis tool must be run as root.
Let’s talk about how to make a U disk installation system!
thanks guys for all your help, but i think there’s something funny going on with the uninstall_box_drive script. now a different error:
Box Drive has been uninstalled.
says its uninstalled but the app still there.
here’s the uninstall_box_drive script:
thanks guys for all your help, but i think there’s something funny going on with the uninstall_box_drive script. now a different error:
Box Drive has been uninstalled.
says its uninstalled but the app still there.
here’s the uninstall_box_drive script:
thanks guys for all your help, but i think there’s something funny going on with the uninstall_box_drive script. now a different error:
Box Drive has been uninstalled.
says its uninstalled but the app still there.
here’s the uninstall_box_drive script:
View desktop website




































![]()
Linux Game Server Managers
![]()
Linux Game Server Managers
9 February, 2015
All Discussions >
General Discussion >
![]()
WHY ? pls Help
<
>
Showing — of comments
![]()
xFaNaTiix
![]()
GuRux3.de
![]()
UltimateByte
You’re gonna have to learn the basics of Linux a bit first.
![]()
GuRux3.de
<
>
Showing — of comments
Per page: 30 50
All Discussions >
General Discussion >
Start a New Discussion
Discussions Rules and Guidelines
View mobile website
iOS cocos2d 2.0-rc1 template installation problem
cocos2d-iphone template installer
Error: Do not run this script as root.
'root' is no longer supported
RECOMMENDED WAY: /Users/papabox/Downloads/cocos2d-iphone-2.0-rc1/install-templates.sh -f
# Make sure root is not executed
if [[ "$(id -u)" == "0" ]]; then
echo ""
echo "Error: Do not run this script as root." 1>&2
echo ""
echo "'root' is no longer supported" 1>&2
echo ""
echo "RECOMMENDED WAY:" 1>&2
echo " $0 -f" 1>&2
echo ""
exit 1
fi
Just delete the script code that judges root.
Проблема установки шаблона iOS cocos2d 2.0-rc1
cocos2d-iphone template installer
Error: Do not run this script as root.
'root' is no longer supported
RECOMMENDED WAY: /Users/papabox/Downloads/cocos2d-iphone-2.0-rc1/install-templates.sh -f
После поиска в Интернете я обнаружил, что уже есть друзья (адрес блога: http://hulefei29.iteye.com/blog/1493653), чтобы выяснить, что следующий код в файле install-templates.sh определяет, что существует проблема с разрешениями root
# Make sure root is not executed
if [[ "$(id -u)" == "0" ]]; then
echo ""
echo "Error: Do not run this script as root." 1>&2
echo ""
echo "'root' is no longer supported" 1>&2
echo ""
echo "RECOMMENDED WAY:" 1>&2
echo " $0 -f" 1>&2
echo ""
exit 1
fi
Просто удалите этот код скрипта, который оценивает root.

June 15th, 2012
Содержание- «This script must be run as root»
- Re: «This script must be run as root»
- Re: «This script must be run as root»
- Re: «This script must be run as root»
- Re: «This script must be run as root»
- Re: «This script must be run as root»
- Re: «This script must be run as root»
- Re: «This script must be run as root»
- Re: «This script must be run as root»
- Re: «This script must be run as root»
- Must run as root, but I am already root
- Re: Must run as root, but I am already root
- Re: Must run as root, but I am already root
- Re: Must run as root, but I am already root
- Re: Must run as root, but I am already root
- Re: Must run as root, but I am already root
- Re: Error: Must run as root
- Re: Error: Must run as root
- Re: Error: Must run as root
- Re: Error: Must run as root
- Re: Error: Must run as root
- Bookmarks
- Posting Permissions
- Re: Помогите пожалуста установить драйвер NVIDIA
- «This script must be run as root»
- Unixforum. org
- «This script must be run as root»
- «This script must be run as root»
- Ready to work
- «This script must be run as root»
- «This script must be run as root»
- «This script must be run as root»
- «This script must be run as root»
- «This script must be run as root»
- Объяснение
- «This script must be run as root»
- Как проверить, работает ли с правами root в bash script
- Запуск скрипта от имени root
- запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Re: запуск скрипта от имени root
- Как скрипт может проверить, запускается ли он от имени root?
- тесты
- Заключение
- Почему я публикую это решение после стольких лет, когда ОП спросил
«This script must be run as root»
Hello.
I am trying to install a program, but when I enter «./install» in the terminal, I get the message:
«This script must be run as root»
How can I run it as root, and what does that mean ?

June 15th, 2012
Re: «This script must be run as root»
Use
root is the privileged adiminstrator’s account in Linux. It’s usually needed for example to install software outside your home folder.Be careful what you do and run as root. Only run programs and scripts from trustworthy sources that way as the can harm your system.

June 15th, 2012
Re: «This script must be run as root»
Thank you.
I used the «sudo ./install» command and it asked me for my password, which I entered. Then I got the message «command not found», though I navigated exactly to the directory where it is inside.
I am trying to install Avira Antivir Personal for Linux, if that helps. I unzipped the gz package to the /tmp folder in the main drive, where Linux is installed. I renamed it to «antivir» since the original name was long and complicated.
Yet I cannot get it to install.


June 15th, 2012
Re: «This script must be run as root»
Do I have to enter «sudo ./install» exactly or something like «sudo cd /tmp/antivir/install» ?

June 15th, 2012
Re: «This script must be run as root»
I quote from the Terminal with translations in bold, since it is the German version:
So first it asks me for permission, and when I enter «sudo» before the «./install» it suddenly does not find the command anymore ?!

But when I open the folder with the file manager, the install command/file is clearly there !

June 15th, 2012
Re: «This script must be run as root»
Could it be that the program, though written for Linux, is not compatible with Ubuntu ?
Last edited by Ali_Barba; June 15th, 2012 at .

June 15th, 2012
Re: «This script must be run as root»
Maybe somebody could download the program, too, and see whether it works ? The source is definitely trustworthy, one of the major antivirus companies. But maybe they made some mistake while writing the installer and it is corrupted ?


June 15th, 2012
Re: «This script must be run as root»
Have a look here: https://help.ubuntu.com/community/RootSudo
Please post back if you have any further questions or comments.

June 15th, 2012
Re: «This script must be run as root»
Originally Posted by lisati

Yeah, I got the sudo thing now, but it still will not install.
See the quote from the Terminal above.

June 16th, 2012
Re: «This script must be run as root»
Could you show the output of an ‘ls’ in the install directory?
bertenvdb
- Posts: 6
- Joined: 2015-01-21 15:25
- Location: Belgium
Must run as root, but I am already root
by bertenvdb »
I’m trying to install OpenNMS. I need to execute:
Code: Select all
sudo $OPENNMS_HOME/bin/install -disBut wether I do the above using sudo or logged as root, I get:
Code: Select all
Error: you must run this script as root, not 'UID=0(root'Code: Select all
# User privilege specification
root ALL=(ALL:ALL) ALL
berten ALL=(ALL:ALL) ALLuname -a: Linux kira 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u1 x86_64 GNU/Linux
bertenvdb
- Posts: 6
- Joined: 2015-01-21 15:25
- Location: Belgium
Re: Must run as root, but I am already root
by bertenvdb »
Code: Select all
berten@kira:/usr/share/opennms$ sudo $OPENNMS_HOME/bin/install -dis
Error: you must run this script as root, not 'UID=0(root'
berten@kira:/usr/share/opennms$ su root
Wachtwoord:
root@kira:/usr/share/opennms# $OPENNMS_HOME/bin/install -dis
Error: you must run this script as root, not 'UID=0(root'schnuller
- Posts: 386
- Joined: 2014-11-25 05:05
Re: Must run as root, but I am already root
by schnuller »
bertenvdb
- Posts: 6
- Joined: 2015-01-21 15:25
- Location: Belgium
Re: Must run as root, but I am already root
by bertenvdb »
schnuller wrote:
Perhaps try su —
I tried this, but no dice.
roseway wrote:Have you tried examining the script? Search for the error message and see what triggers it. It’s probably just a bug in the script, and you could edit it to bypass the root check.
Will post a topic on OpenNMS as soon as I wake up in the morning.
Thanks for the support ! ![]()
For reference or curious people:
Code: Select all
#!/bin/sh -
OPENNMS_HOME="/usr/share/opennms"
OPENNMS_BINDIR="/usr/share/opennms/bin"
RUNAS="root"
ULIMIT=`which ulimit 2>/dev/null`
if [ -n $ULIMIT ]; then for SIZE in 1024 2048 4096 8192 unlimited; do ulimit -n "$SIZE" >/dev/null 2>&1 if [ $? -gt 0 ]; then break fi done
fi
myuser="`id | sed -e 's/uid=[0-9][0-9]*(//' -e 's/).*//'`"
#if [ x"$myuser" = x"$RUNAS" ]; then
# true # all is well
#else
# echo "Error: you must run this script as $RUNAS, not '$myuser'" >&2
# exit 4 # According to LSB: 4 - user had insufficient privileges
#fi
if [ -f "$OPENNMS_HOME/etc/opennms.conf" ]; then . "$OPENNMS_HOME/etc/opennms.conf"
fi
exec "$OPENNMS_BINDIR"/runjava -r -- \ $ADDITIONAL_MANAGER_OPTIONS \ -Dopennms.home="$OPENNMS_HOME" \ -Dlog4j.configurationFile="$OPENNMS_HOME"/etc/log4j2-tools.xml \ -cp "$OPENNMS_HOME/lib/opennms_bootstrap.jar" \ org.opennms.bootstrap.InstallerBootstrap \ "$@"fsmithred
- Posts: 1873
- Joined: 2008-01-02 14:52
Re: Must run as root, but I am already root
by fsmithred »
That’s weird. It looks like it should work. It does work on command line, and it does work if I put just that test in a script by itself. Is there something odd about the output of the id command? You could add
FWIW, here’s another way to do the same test:
Code: Select all
# Check that user is root.
[[ $(id -u) -eq 0 ]] || { echo -e "\n\t You need to be root!\n" ; exit 1 ; }impensj
- Posts: 1
- Joined: 2016-07-05 16:58
Re: Must run as root, but I am already root
by impensj »
The script expects the `id` command to return a line containing uid= but gets a line containing UID= instead.
root@DSM:/volume1/docker/synology-wireguard# docker run --rm --privileged --env PACKAGE_ARCH=geminilake --env DSM_VER=7.0 -v $(pwd)/artifacts:/result_spk synobuild
WireGuard version: 1.0.20210424
WireGuard tools version: 1.0.20210424
libmnl version: 1.0.4
Cloning into 'pkgscripts-ng'...
[2021-06-02 13:01:34,303] INFO: Download... https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/base_env-7.0.txz
[2021-06-02 13:02:24,497] INFO: Download... https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/ds.geminilake-7.0.env.txz
[2021-06-02 13:02:50,277] INFO: Download... https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/ds.geminilake-7.0.dev.txz
[2021-06-02 13:03:10,289] INFO: tar -xhf /toolkit_tarballs/base_env-7.0.txz -C /build_env/ds.geminilake-7.0
[2021-06-02 13:03:30,857] INFO: tar -xhf /toolkit_tarballs/ds.geminilake-7.0.env.txz -C /build_env/ds.geminilake-7.0
[2021-06-02 13:04:25,726] INFO: tar -xhf /toolkit_tarballs/ds.geminilake-7.0.dev.txz -C /build_env/ds.geminilake-7.0
[2021-06-02 13:04:55,718] INFO: All task finished.
============================================================ Parse argument result
------------------------------------------------------------
platforms : geminilake
env_section : default
env_version : 7.0
dep_level : 1
parallel_proj : 1
branch : master
suffix :
collect : True
collecter : True
link : True
update_link : False
build : True
install : True
only_install : False
parallel : 4
build_opt : -J
install_opt :
print_log : True
tee : True
sdk_ver : 6.2
package : WireGuard
Processing [7.0-40955]: geminilake
============================================================ Start to run "Traverse project"
------------------------------------------------------------
Projects: WireGuard
============================================================ Start to run "Link Project"
------------------------------------------------------------
Link /pkgscripts-ng -> /build_env/ds.geminilake-7.0/pkgscripts-ng
Link //source/WireGuard -> /build_env/ds.geminilake-7.0/source/WireGuard
============================================================ Start to run "Build Package"
------------------------------------------------------------
[geminilake] env PackageName=WireGuard /pkgscripts-ng/SynoBuild --geminilake -c --min-sdk 6.2 -J WireGuard
/pkgscripts-ng/include/check: line 93: /dev/null: Permission denied
ERROR: This script must be run as root
Traceback (most recent call last): File "/pkgscripts-ng/include/python/exec_env.py", line 76, in execute output = commandrunner.run(cmd, display=display, **kwargs) File "/pkgscripts-ng/include/python/commandrunner.py", line 39, in run raise RunShellFailed(p.returncode, cmd, output)
commandrunner.RunShellFailed
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/pkgscripts-ng/include/python/parallel.py", line 15, in __call__ result = self.__callable(*args, **kwargs) File "/pkgscripts-ng/include/python/pkgcommon.py", line 191, in run_command env.execute(cmd, display=len(self.env_config.platforms) File "/pkgscripts-ng/include/python/exec_env.py", line 79, in execute raise EnvError(
exec_env.EnvError: ('Execute chroot /build_env/ds.geminilake-7.0 env PackageName=WireGuard /pkgscripts-ng/SynoBuild --geminilake -c --min-sdk 6.2 -J WireGuard failed', '/pkgscripts-ng/include/check: line 93: /dev/null: Permission deniednERROR: This script must be run as root')
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last): File "/pkgscripts-ng/include/python/exec_env.py", line 76, in execute output = commandrunner.run(cmd, display=display, **kwargs) File "/pkgscripts-ng/include/python/commandrunner.py", line 39, in run raise RunShellFailed(p.returncode, cmd, output)
commandrunner.RunShellFailed
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/pkgscripts-ng/include/python/parallel.py", line 15, in __call__ result = self.__callable(*args, **kwargs) File "/pkgscripts-ng/include/python/pkgcommon.py", line 191, in run_command env.execute(cmd, display=len(self.env_config.platforms) File "/pkgscripts-ng/include/python/exec_env.py", line 79, in execute raise EnvError(
exec_env.EnvError: ('Execute chroot /build_env/ds.geminilake-7.0 env PackageName=WireGuard /pkgscripts-ng/SynoBuild --geminilake -c --min-sdk 6.2 -J WireGuard failed', '/pkgscripts-ng/include/check: line 93: /dev/null: Permission deniednERROR: This script must be run as root')
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "pkgscripts-ng/PkgCreate.py", line 184, in <module> main(sys.argv[1:]) File "pkgscripts-ng/PkgCreate.py", line 177, in main packer.pack_package() File "/pkgscripts-ng/include/python/pkguniform.py", line 437, in pack_package worker.execute() File "/pkgscripts-ng/include/python/pkgcommon.py", line 86, in execute self._process_output(self._run(*argv)) File "/pkgscripts-ng/include/python/pkgcommon.py", line 212, in _run return doPlatformParallel(self.run_command, self.env_config.platforms) File "/pkgscripts-ng/include/python/parallel.py", line 60, in doPlatformParallel output[item] = results[item].get() File "/usr/lib/python3.8/multiprocessing/pool.py", line 771, in get raise self._value
exec_env.EnvError: ('Execute chroot /build_env/ds.geminilake-7.0 env PackageName=WireGuard /pkgscripts-ng/SynoBuild --geminilake -c --min-sdk 6.2 -J WireGuard failed', '/pkgscripts-ng/include/check: line 93: /dev/null: Permission deniednERROR: This script must be run as root')
Build log
=========
/pkgscripts-ng/include/check: line 93: /dev/null: Permission denied
ERROR: This script must be run as root
Install log
===========
cat: /build_env/ds.geminilake-7.0/logs.install: No such file or directoryDo i miss something? I did it before but can’t figure out whats wrong or is it related to the new DSM version?
I downloaded a .run file for a Nvidia driver, but when I run it in the terminal it tells me it must be run as root.
Well, I got the file to run but it turns out that the driver will not recognize my card.
I’ve heard about other problems with Nvidia cards not working right with 64 bit versions of 12.04.
47 gold badges326 silver badges398 bronze badges
asked May 31, 2012 at 3:41
You need to do two things; both from a Terminal prompt:
- Change to the directory where you have the
.runfile stored. - Type:
chmod 755 filename.run - Type:
sudo ./filename.run
The above commands will make the file executable and will launch the executable with root-level permissions.

52 gold badges465 silver badges716 bronze badges
answered May 31, 2012 at 4:00
Justin Andrusk
2 gold badges19 silver badges19 bronze badges
Add the command «sudo» before the command. For example: sudo blah.sh
After you enter your password the command will run as root. Be careful to verify the trustworthiness of a package or command before running it with sudo.
answered May 31, 2012 at 3:59

root is the master account in Ubuntu; every account has limited privileges but the root account has no limitations. The reason for hiding root is that in most cases you don’t need root access. The analog in Windows would be having to authenticate when you want to install a driver; in Ubuntu you have to be root or have root privileges.
There are two ways for you to get access as root. You can type:
sudo <whatever-command> and Ubuntu will ask you for your password and then execute that command as root.
sudo su, where you’ll input your own password and then you will become root (i.e. you will be logged in as root).
I prefer the latter because it gives me more control; sometimes running a command just as root isn’t enough, but doing it this way can be more dangerous (i.e. you could accidentally cause more damage).
I recommend trying the first way. And then trying the second way if that doesn’t work. Just make sure you get out of root after you’re done (i.e. type exit after you’re finished doing what you need to do as root).
answered May 31, 2012 at 4:03
If you have enabled the root account you can use
suEnter the password for root, cd to your application folder, then run
./package.run
55 gold badges212 silver badges322 bronze badges
answered Feb 22, 2017 at 10:53
- Forum
- The Ubuntu Forum Community
- Ubuntu Official Flavours Support
- General Help
I’m on Natty, and I attempted to install BatteryStatus via Terminal
This is the command I ran:
add-apt-repository ppa:iaz/battery-status
Yet it gives me the error:
Error: Must run as root
Please help me, I really wish to install BatteryStatus.
Re: Error: Must run as root
sudo add-apt-repository ppa:iaz/battery-status
http://xkcd.com/293/
There are 10 kinds of people in this world: Those who understand ternary, those who don’t, and those who confuse it with binary.Re: Error: Must run as root
Originally Posted by WorMzy

sudo add-apt-repository ppa:iaz/battery-status
It gives back this when I run it
chrisv@chris:~$ sudo add-apt-repository ppa:iaz/battery-status [sudo] password for chrisv: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80/ --recv 28FED23C44FB7ED6EBEDEF6B90DCEB7B6E7F922F gpg: requesting key 6E7F922F from hkp server keyserver.ubuntu.com gpg: key 6E7F922F: "Launchpad PPA for Ivan Zorin" not changed gpg: Total number processed: 1 gpg: unchanged: 1 chrisv@chris:~$ ^C chrisv@chris:~$
Re: Error: Must run as root
You already have that PPA added as a software source. You can’t add it again.
http://xkcd.com/293/
There are 10 kinds of people in this world: Those who understand ternary, those who don’t, and those who confuse it with binary.Re: Error: Must run as root
Originally Posted by WorMzy

You already have that PPA added as a software source. You can’t add it again.
So what I can do install this then?
I’ve checked my sources, but I’m still encountering issues when trying to install BatteryStatus.
Re: Error: Must run as root
What can you do to install what?
sudo apt-get update && sudo apt-get install <package name>
http://xkcd.com/293/
There are 10 kinds of people in this world: Those who understand ternary, those who don’t, and those who confuse it with binary.
Bookmarks
Bookmarks

Posting Permissions
Re: Помогите пожалуста установить драйвер NVIDIA
ага
я с рута ставил и вот что мне вылезло!!!
ERROR: An NVIDIA kernel module ‘nvidia’ appears to already be loaded
in your kernel. This may be because it is in use (for example, by the X server),
but may also happen if your kernel was configured without
support for module unloading. Please be sure you have exited X
before attempting to upgrade your driver. If you have exited X, know
that your kernel supports module unloading, and still receive this
message, then an error may have occured that has corrupted the NVIDIA
kernel module’s usage count; the simplest remedy is to reboot your computer.
кто нибудь знает что это значит?????
(24.01.05 22:58:10 MSK)
- Показать ответ
- Ссылка
Большая часть драйверов уже присутствует в ядре Linux. Проприетарный драйвер от нвидии устанавливается путем скачивания с официального сайта и запуска универсального установщика ./NVIDIA-Linux-x86-1.0-6629-pkg1.run. Есть и более удобные методы установки, чем искать сайт вендора, проверять появились ли драйвера, скачивать их и затем устанавливать — из репозитария пакетов одной командой . В разных дистрибутивах — разные репозитарии и разные пакетные менеджеры: «emerge nvidia-drivers», «yum install kmod-nvidia» и т.д.
Официальный сайт с исходниками и документацией —
I have a simple lua-nginx conf of this style
server { server_name payment.mybackend.fr payment.mybackend.fr; set $rails_root /home/deploy/api/MAP; set $env 'cloud'; location ~ /(paypal|paybox_system) { content_by_lua_file $rails_root/lib/nginx-redis-payment/$1.lua; }
}When I run it with sudo, it works perfectly.
How can I make nginx don’t use root privileges to execute my lua scripts?
asked Sep 16, 2015 at 14:39
This is likely related to the lua scripts in question, and have not much to do with nginx.
Look further into any possible logs that nginx as well as the scripts generate when they fail.
answered Sep 26, 2015 at 1:43
4 gold badges88 silver badges120 bronze badges
answered Sep 22, 2015 at 14:11
«This script must be run as root»
Could it be that the program, though written for Linux, is not compatible with Ubuntu ?
Last edited by Ali_Barba; June 15th, 2012 at 11:38 PM .
Unixforum. org
Форум для пользователей UNIX-подобных систем
- Темы без ответов
- Активные темы
- Поиск
- Статус форума
«This script must be run as root»
Do I have to enter «sudo ./install» exactly or something like «sudo cd /tmp/antivir/install» ?
«This script must be run as root»
I quote from the Terminal with translations in bold, since it is the German version:
So first it asks me for permission, and when I enter «sudo» before the «./install» it suddenly does not find the command anymore ?! 
But when I open the folder with the file manager, the install command/file is clearly there !
Ready to work
You must have a U disk before you start the Macos U disk.
- U disk size> 16g
- The U disk ensures that important data is not included, because the U disk is initialized
- Download MacOS system
First, open the App Store Search Macos Big Sur, click to view, click Get.
Waiting for the download, do not start the installation after the download is complete, the installer can start automatically after downloading, then press «Command» + «Q» to exit the installer. After downloading, you will start the installer by default. At this time, press «Command» + «Q» to exit the installer. Enter the application, you can see the downloaded system image file.

Second, open the terminal
- Enter «sudo» and tap «space»
- Open «Visit» — «Applications» — «Install Macos Big Sur.App» — «Display Package Content» — «Contents» — «Resources» — Find «CreateInstallMedia» and drag to «Terminal» — Tap «Space»
- Enter «—volume» in tap «space»
- Drop the U disk into the terminal — tap the «Enter key, ie Return», then prompted to enter the password, then enter the password, prompt «Y» to continue, then enter «Y» is very good, it is trouble.
Third, install the Macos BIG SUR system from the U disk
After making a good Macos Big Sur system launches the USB flash drive, restart the Mac, and then hold the «Option» button until «Install BIG SUR» appears again, then click «Install BIG SUR» to start installing the Macos BIG SUR system !
Now, why do you say:This tool must be run as root.
Just add sudo before command
/Applications/install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia —volume /Volumes/macBigSur
«This script must be run as root»
Please post back if you have any further questions or comments.
«This script must be run as root»
I used the «sudo ./install» command and it asked me for my password, which I entered. Then I got the message «command not found», though I navigated exactly to the directory where it is inside.
I am trying to install Avira Antivir Personal for Linux, if that helps. I unzipped the gz package to the /tmp folder in the main drive, where Linux is installed. I renamed it to «antivir» since the original name was long and complicated.
Yet I cannot get it to install.
«This script must be run as root»
Thread Tools
Display
«This script must be run as root»
I am trying to install a program, but when I enter «./install» in the terminal, I get the message:
«This script must be run as root»
How can I run it as root, and what does that mean ?
![]()
«This script must be run as root»
Maybe somebody could download the program, too, and see whether it works ? The source is definitely trustworthy, one of the major antivirus companies. But maybe they made some mistake while writing the installer and it is corrupted ?
![]()
Объяснение
Так как чтение переменной bash стандарта во много раз быстрее, эффективный идентификатор пользователя, чем выполнение команды id -u для POSIX -ly, находит пользователя ID, это решение объединяет оба в красиво упакованную функцию. Если и только если $EUID по какой-либо причине недоступен, команда id -u будет выполнена, гарантируя, что мы получим правильное возвращаемое значение независимо от обстоятельств.
«This script must be run as root»
root is the privileged adiminstrator’s account in Linux. It’s usually needed for example to install software outside your home folder.
Be careful what you do and run as root. Only run programs and scripts from trustworthy sources that way as the can harm your system.
Как проверить, работает ли с правами root в bash script
Я пишу script, который требует прав на уровне корневого уровня, и я хочу сделать так, чтобы, если script не запущен как root, он просто перекликается с “Пожалуйста, запустите от имени пользователя root”. и выходы.
Здесь некоторый псевдокод для того, что я ищу:
Как я могу (чище и безопасно) справиться с этим? Спасибо!
А, просто для того, чтобы уточнить: часть (сделайте что-то) будет включать в себя запуск команд, которые сами по себе требуют root. Так что запуск его, как обычный пользователь, просто придумал бы ошибку. Это просто предназначено для чистого запуска script, для которого требуются корневые команды, без использования sudo внутри script, я просто ищу какой-то синтаксический сахар.
Было дано несколько ответов, но, по-видимому, лучшим способом является использование:
- id -u
- Если запустить с правами root, вернет идентификатор 0.
Это кажется более надежным, чем другие методы, и кажется, что он возвращает id из 0, даже если script выполняется через sudo .
Переменная среды $ EUID содержит текущий UID пользователя. Root UID равен 0. Используйте что-то вроде этого в вашем скрипте:
В bash script у вас есть несколько способов проверить, является ли текущий пользователь root.
Как предупреждение , не проверяйте, является ли пользователь root, используя имя пользователя root . Ничто не гарантирует, что пользователь с ID 0 называется root . Это очень сильное соглашение, которое широко применяется, но любой может переименовать суперпользователя в другое имя.
Я думаю, что лучший способ использования bash – использовать $EUID , с man-страницы:
Это лучший способ, чем $UID , который может быть изменен и не отражает реального пользователя, запускающего script.
Способ, которым я подхожу к этой проблеме, заключается в том, чтобы вставлять sudo в мои команды, когда он не запускается с правами root. Вот пример:
Таким образом моя команда запускается root при использовании суперпользователя или sudo при запуске обычного пользователя.
Если ваш script всегда должен быть запущен root, просто установите права соответственно ( 0500 ).
Кроме того, при правильном использовании sudo вы можете проверить script и посмотреть, работает ли он с правами root. Если нет, попросите его вспомнить через sudo , а затем запустите с правами root.
В зависимости от того, что делает script, другой может быть настройка записи sudo для любых специализированных команд, которые могут понадобиться script.
Существует простая проверка для пользователя, являющегося пользователем root.
Это также предполагает, что вы хотите выйти с 1, если вы терпите неудачу. Функция error – это некоторое чутье, которое устанавливает выходной текст в красный (не нужен, но довольно классный, если вы меня спрашиваете).
0- Прочитайте официальную документацию GNU Linux, есть много способов сделать это правильно.
1- убедитесь, что вы помещаете подпись оболочки, чтобы избежать ошибок в интерпретации:
2- это мой script
Очень простой способ просто поставить:
Преимущество использования этого вместо id заключается в том, что вы можете проверить, не работает ли какой-либо пользователь, не являющийся пользователем root; например.
Если script действительно требует доступа к корню, тогда его права на файлы должны отражать это. Наличие корневого script исполняемого пользователями, не являющимся пользователем root, будет красным. Я рекомендую вам не контролировать доступ с помощью проверки if .
В этом ответе, чтобы было ясно, я предполагаю, что читатель может читать сценарии оболочки bash и POSIX, такие как dash .
Я полагаю, что здесь мало что можно объяснить, потому что ответы с большим количеством голосов объясняют многое из этого.
Тем не менее, если есть что-то, чтобы объяснить дальше, не стесняйтесь комментировать, я сделаю все возможное, чтобы заполнить пробелы.
Запуск скрипта от имени root
запуск скрипта от имени root
Сообщение safronowmax » 13.12.2012 20:08
Re: запуск скрипта от имени root
Сообщение allez » 13.12.2012 20:35
Re: запуск скрипта от имени root
Сообщение safronowmax » 13.12.2012 22:05
allez, вы имеете в виду например так:
#!bin/bash
sudo mkdir test
Re: запуск скрипта от имени root
Сообщение allez » 13.12.2012 22:23
Re: запуск скрипта от имени root
Сообщение safronowmax » 13.12.2012 22:33
Проблема в том, что данный скрипт будет отдавать данные в zabbix, и такой вариант не подойдет, попробовал в /etc/sudoerc прописать пользователя с правами root: vbox ALL=(ALL) ALL, но что-то все равно не работает
Re: запуск скрипта от имени root
Сообщение Bizdelnick » 13.12.2012 23:43
Re: запуск скрипта от имени root
Сообщение Vascom » 14.12.2012 09:06
Re: запуск скрипта от имени root
Сообщение allez » 14.12.2012 12:23
Re: запуск скрипта от имени root
Сообщение eddy » 14.12.2012 13:54
Re: запуск скрипта от имени root
Сообщение trendix » 14.12.2012 20:52
Re: запуск скрипта от имени root
Сообщение drBatty » 17.12.2012 11:42
Скоро придёт
Осень
Re: запуск скрипта от имени root
Сообщение liaonau » 17.12.2012 18:27
Re: запуск скрипта от имени root
Сообщение drBatty » 18.12.2012 11:23
Скоро придёт
Осень
Re: запуск скрипта от имени root
Сообщение Kopilov » 18.12.2012 18:52
Re: запуск скрипта от имени root
Сообщение drBatty » 19.12.2012 16:31
Скоро придёт
Осень
Re: запуск скрипта от имени root
Сообщение Poor Fred » 19.12.2012 16:39
Как будет отдавать? Может быть, наоборот, zabbix-agent будет сам забирать? Тогда и пользователь должен быть другой. zabbix, как ни странно.
Re: запуск скрипта от имени root
Сообщение Kopilov » 19.12.2012 17:43
Re: запуск скрипта от имени root
Сообщение liaonau » 19.12.2012 19:22
Re: запуск скрипта от имени root
Сообщение drBatty » 20.12.2012 11:37
смотря на что. Когда KDE3 сменилась на KDE4 то очевидно и документация поменялась, но вот какой смысл менять загрузочные скрипты — мне непонятно. Ну а раз они не меняются, то и документация к ним тоже.
Как скрипт может проверить, запускается ли он от имени root?
Я пишу простой bash-скрипт, но мне нужно проверить, запущен ли он от имени пользователя root или нет. Я знаю, что, вероятно, есть очень простой способ сделать это, но я понятия не имею, как.
Просто чтобы быть ясно:
Что простой способ , чтобы написать сценарий foo.sh , так что команда ./foo.sh выводит 0 , и команда sudo ./foo.sh выводит 1 ?
Единственная надежная программа, которая проверяет, вошел ли аккаунт как root или нет:
Я использую -u для эффективного идентификатора пользователя, а не -r для реального идентификатора пользователя. Права доступа определяются с помощью эффективного идентификатора пользователя, а не реальные один.
тесты
/etc/passwd содержит следующие имена пользователей с идентификатором пользователя 0 в указанном порядке:
Войдя в систему root2 , дает следующие результаты:
- whoami : rootx
- echo $USER : root2 (возвращает пустую строку, если программа была запущена в пустой среде, например env -i sh -c ‘echo $USER’ )
- id -u : 0 Как видите, другие программы не id -u прошли эту проверку, только пройдены.
Заключение
Как бы вам это ни нравилось, среда Unix/Linux очень разнообразна. Это означает, что есть люди, которым так нравится bash , что они даже не думают о переносимости (POSIX оболочки). Другие, как я, предпочитают POSIX оболочки. В настоящее время это вопрос личного выбора и потребностей.
попробуйте следующий код:
Один простой способ сделать скрипт доступным только для пользователя root – запустить скрипт со строкой:
Насколько я знаю, правильный способ проверить это:
Смотрите раздел “Тестирование на корень” здесь:
id -u намного лучше, чем whoami , поскольку некоторые системы, такие как android, могут не предоставлять слово root.
Проверьте, являетесь ли вы пользователем root, и выйдите из системы, если вы не:
Или в этом примере попытайтесь создать каталог в корневом расположении, а затем попытайтесь после повышения прав.
Проверьте, являетесь ли вы пользователем root и, если возможно, не повышать его:
Примечание редактора: если вам не нужны двойные скобки, используйте одинарные для переносимости кода.
Почему я публикую это решение после стольких лет, когда ОП спросил
Что ж, если я правильно вижу, кажется, что выше отсутствует фрагмент кода.
Видите ли, есть много переменных, которые необходимо учитывать, и одна из них сочетает в себе производительность и надежность.






