You must be root to run this script

You must be root to run this script Техника

I tend to address this by allowing the process that runs the server, in this case the webserver, to execute the relevant command, and only that command, via passwordless sudo.

nagios  ALL=(root) NOPASSWD: /usr/lib/nagios/plugins/check_md_raid

You would have something similar, perhaps:

apache  ALL=(root) NOPASSWD: /sbin/service dnsmasq restart

To address your concerns above, this doesn’t allow anyone who can subvert the apache process to run sudo bash, sudo shutdown -h now, or even sudo service dnsmasq stop. It only allows exactly what’s specified in the sudoers file.

It’s true that if the service command is badly written, and if someone can find a way to make running service dnsmasq stop as root via sudo change the mode on the passwd file, or start an allow-all sshd on port 22222, or indeed do anything nefarious, then you have a problem. But in such a case you have a problem however you run the service command as root, whether it’s via sudo or any other mechanism. sudo does its best to sanitise the environment, and the service command is a stock part of most GNU/Linuxes (and has been for some time) and therefore probably has no obvious holes.

Running the service command via passwordless sudo is no less safe than any other method of running it, and probably more safe than many home-brewed or other less-well-tested ways.

  1. You must be root to run this script

    June 15th, 2012

    Содержание
    1. «This script must be run as root»
    2. Re: «This script must be run as root»
    3. Re: «This script must be run as root»
    4. Re: «This script must be run as root»
    5. Re: «This script must be run as root»
    6. Re: «This script must be run as root»
    7. Re: «This script must be run as root»
    8. Re: «This script must be run as root»
    9. Re: «This script must be run as root»
    10. Re: «This script must be run as root»
    11. «This script must be run as root»
    12. Run this script
    13. Care sharing root account!!
    14. «This script must be run as root»
    15. «This script must be run as root»
    16. «This script must be run as root»
    17. Must run as root, but I am already root
    18. Must run as root, but I am already root
    19. Re: Must run as root, but I am already root
    20. Re: Must run as root, but I am already root
    21. Re: Must run as root, but I am already root
    22. Re: Must run as root, but I am already root
    23. Re: Must run as root, but I am already root
    24. Re: Must run as root, but I am already root
    25. Re: Must run as root, but I am already root
    26. Re: Must run as root, but I am already root
    27. Re: Must run as root, but I am already root
    28. Re: Must run as root, but I am already root
    29. 8 Answers 8
    30. 8 Answers 8
    31. «This script must be run as root»
    32. «This script must be run as root»
    33. «This script must be run as root»
    34. «This script must be run as root»
    35. Allow bash script to be run as root, but not sudo
    36. Regarding logname
    37. «This script must be run as root»
    38. First quick way using pstree
    39. Amazon EC2 set-up failure #10
    40. «This script must be run as root»
    41. Run this script
    42. «This script must be run as root»
    43. «This script must be run as root»
    44. «This script must be run as root»
    45. «This script must be run as root»
    46. Workaround for executing this by using sudo anyway
    47. «This script must be run as root»
    48. Run this script
    49. Must run as root, but I am already root
    50. Must run as root, but I am already root
    51. Re: Must run as root, but I am already root
    52. Re: Must run as root, but I am already root
    53. Re: Must run as root, but I am already root
    54. Re: Must run as root, but I am already root
    55. Re: Must run as root, but I am already root
    56. Re: Must run as root, but I am already root
    57. Re: Must run as root, but I am already root
    58. Re: Must run as root, but I am already root
    59. Re: Must run as root, but I am already root
    60. Re: Must run as root, but I am already root
    61. «This script must be run as root»
    62. «This script must be run as root»
    63. Allow bash script to be run as root, but not sudo
    64. Regarding comment about renamed sudo
    65. Because we are speaking about Un*x
    66. With ps only, you could loop over ps ho ppid
    67. Run this script
    68. «This script must be run as root»
    69. Run this script
    70. Must run as root, but I am already root
    71. Must run as root, but I am already root
    72. Re: Must run as root, but I am already root
    73. Re: Must run as root, but I am already root
    74. Re: Must run as root, but I am already root
    75. Re: Must run as root, but I am already root
    76. Re: Must run as root, but I am already root
    77. Re: Must run as root, but I am already root
    78. Re: Must run as root, but I am already root
    79. Re: Must run as root, but I am already root
    80. Re: Must run as root, but I am already root
    81. Re: Must run as root, but I am already root
    82. About /proc/self/loginuid under Linux
    83. Please help me #21
    84. Conclusion

    «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 ?

  2. diesch's Avatar

    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.

  3. You must be root to run this script

    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. You must be root to run this script

  4. You must be root to run this script

    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» ?

  5. You must be root to run this script

    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 ?! You must be root to run this script

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

  6. You must be root to run this script

    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 .

  7. You must be root to run this script

    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 ? You must be root to run this script

  8. lisati's Avatar

    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.

  9. You must be root to run this script

    June 15th, 2012

    Re: «This script must be run as root»

    Quote Originally Posted by lisati
    View Post

    Yeah, I got the sudo thing now, but it still will not install.

    See the quote from the Terminal above.

  10. You must be root to run this script

    June 16th, 2012

    Re: «This script must be run as root»

    Could you show the output of an ‘ls’ in the install directory?

Время на прочтение

Предположим, что заказчик попросил вас помочь с переносом скрипта для развертывания централизованного файла sudoers на серверах RHEL и AIX.

You must be root to run this script

Что же, это вполне распространенный сценарий, и на его примере можно продемонстрировать использование расширенных возможностей Ansible, а также того, как меняется подход – от скрипта, который выполняет некую задачу, к идемпотентному (без внесения изменений) описанию и контролю за соблюдением состояния экземпляра.

Возьмем скрипт:

#!/bin/sh
# Desc: Distribute unified copy of /etc/sudoers
#
# $Id: $
#set -x

export ODMDIR=/etc/repos

#
# perform any cleanup actions we need to do, and then exit with the
# passed status/return code
#
clean_exit()
{
cd /
test -f "$tmpfile" && rm $tmpfile
exit $1
}

#Set variables
PROG=`basename $0`
PLAT=`uname -s|awk '{print $1}'`
HOSTNAME=`uname -n | awk -F. '{print $1}'`
HOSTPFX=$(echo $HOSTNAME |cut -c 1-2)
NFSserver="nfs-server"
NFSdir="/NFS/AIXSOFT_NFS"
MOUNTPT="/mnt.$$"
MAILTO="unix@company.com"
DSTRING=$(date +%Y%m%d%H%M)
LOGFILE="/tmp/${PROG}.dist_sudoers.${DSTRING}.log"
BKUPFILE=/etc/sudoers.${DSTRING}
SRCFILE=${MOUNTPT}/skel/sudoers-uni
MD5FILE="/.sudoers.md5"

echo "Starting ${PROG} on ${HOSTNAME}" >> ${LOGFILE} 2>&1

# Make sure we run as root
runas=`id | awk -F'(' '{print $1}' | awk -F'=' '{print $2}'`
if [ $runas -ne 0 ] ; then
echo "$PROG: you must be root to run this script." >> ${LOGFILE} 2>&1
exit 1
fi

case "$PLAT" in
SunOS)
export PINGP=" -t 7 $NFSserver "
export MOUNTP=" -F nfs -o vers=3,soft "
export PATH="/usr/sbin:/usr/bin"
echo "SunOS" >> ${LOGFILE} 2>&1
exit 0
;;
AIX)
export PINGP=" -T 7 $NFSserver 2 2"
export MOUNTP=" -o vers=3,bsy,soft "
export PATH="/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin"
printf "Continuing on AIX...\n\n" >> ${LOGFILE} 2>&1
;;
Linux)
export PINGP=" -t 7 -c 2 $NFSserver"
export MOUNTP=" -o nfsvers=3,soft "
export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
printf "Continuing on Linux...\n\n" >> ${LOGFILE} 2>&1
;;
*)
echo "Unsupported Platform." >> ${LOGFILE} 2>&1
exit 1
esac

##
## Exclude Lawson Hosts
##
if [ ${HOSTPFX} = "la" ]
then
echo "Exiting Lawson host ${HOSTNAME} with no changes." >> ${LOGFILE} 2>&1
exit 0
fi

##
## * NFS Mount Section *
##

## Check to make sure NFS host is up
printf "Current PATH is..." >> ${LOGFILE} 2>&1
echo $PATH >> $LOGFILE 2>&1
ping $PINGP >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
echo " NFS server is DOWN ... ABORTING SCRIPT ... Please check server..." >> $LOGFILE
echo "$PROG failed on $HOSTNAME ... NFS server is DOWN ... ABORTING SCRIPT ... Please check server ... " | mailx -s "$PROG Failed on $HOSTNAME" $MAILTO
exit 1
else
echo " NFS server is UP ... We will continue..." >> $LOGFILE
fi

##
## Mount NFS share to HOSTNAME. We do this using a soft mount in case it is lost during a backup
##
mkdir $MOUNTPT
mount $MOUNTP $NFSserver:${NFSdir} $MOUNTPT >> $LOGFILE 2>&1

##
## Check to make sure mount command returned 0. If it did not odds are something else is mounted on /mnt.$$
##
if [ $? -ne 0 ]; then
echo " Mount command did not work ... Please check server ... Odds are something is mounted on $MOUNTPT ..." >> $LOGFILE
echo " $PROG failed on $HOSTNAME ... Mount command did not work ... Please check server ... Odds are something is mounted on $MOUNTPT ..." | mailx -s "$PROG Failed on $HOSTNAME" $MAILTO
exit 1
else
echo " Mount command returned a good status which means $MOUNPT was free for us to use ... We will now continue ..." >> $LOGFILE
fi

##
## Now check to see if the mount worked
##
if [ ! -f ${SRCFILE} ]; then
echo " File ${SRCFILE} is missing... Maybe NFS mount did NOT WORK ... Please check server ..." >> $LOGFILE
echo " $PROG failed on $HOSTNAME ... File ${SRCFILE} is missing... Maybe NFS mount did NOT WORK ... Please check server ..." | mailx -s "$PROG Failed on $HOSTNAME" $MA
ILTO
umount -f $MOUNTPT >> $LOGFILE
rmdir $MOUNTPT >> $LOGFILE
exit 1
else
echo " NFS mount worked we are going to continue ..." >> $LOGFILE
fi


##
## * Main Section *
##

if [ ! -f ${BKUPFILE} ]
then
cp -p /etc/sudoers ${BKUPFILE}
else
echo "Backup file already exists$" >> ${LOGFILE} 2>&1
exit 1
fi

if [ -f "$SRCFILE" ]
then
echo "Copying in new sudoers file from $SRCFILE." >> ${LOGFILE} 2>&1
cp -p $SRCFILE /etc/sudoers
chmod 440 /etc/sudoers
else
echo "Source file not found" >> ${LOGFILE} 2>&1
exit 1
fi

echo >> ${LOGFILE} 2>&1
visudo -c |tee -a ${LOGFILE}
if [ $? -ne 0 ]
then
echo "sudoers syntax error on $HOSTNAME." >> ${LOGFILE} 2>&1
mailx -s "${PROG}: sudoers syntax error on $HOSTNAME" "$MAILTO" << EOF

Syntax error /etc/sudoers on $HOSTNAME.

Reverting changes

Please investigate.

EOF
echo "Reverting changes." >> ${LOGFILE} 2>&1
cp -p ${BKUPFILE} /etc/sudoers
else
#
# Update checksum file
#
grep -v '/etc/sudoers' ${MD5FILE} > ${MD5FILE}.tmp
csum /etc/sudoers >> ${MD5FILE}.tmp
mv ${MD5FILE}.tmp ${MD5FILE}
chmod 600 ${MD5FILE}
fi

echo >> ${LOGFILE} 2>&1

if [ "${HOSTPFX}" = "hd" ]
then
printf "\nAppending #includedir /etc/sudoers.d at end of file.\n" >> ${LOGFILE} 2>&1
echo "" >> /etc/sudoers
echo "## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)" >> /etc/sudoers
echo "#includedir /etc/sudoers.d" >> /etc/sudoers
fi

##
## * NFS Un-mount Section *
##

##
## Unmount /mnt.$$ directory
##
umount ${MOUNTPT} >> $LOGFILE 2>&1
if [ -d ${MOUNTPT} ]; then
rmdir ${MOUNTPT} >> $LOGFILE 2>&1
fi

##
## Make sure that /mnt.$$ got unmounted
##
if [ -f ${SRCFILE} ]; then
echo " The umount command failed to unmount ${MOUNTPT} ... We will not force the unmount ..." >> $LOGFILE
umount -f ${MOUNTPT} >> $LOGFILE 2>&1
if [ -d ${MOUNTPT} ]; then
rmdir ${MOUNTPT} >> $LOGFILE 2>&1
fi
else
echo " $MOUNTPT was unmounted ... There is no need for user intervention on $HOSTNAME ..." >> $LOGFILE
fi

#
# as always, exit cleanly
#
clean_exit 0

Здесь 212 строк кода, при этом какой-либо контроль версий в файле sudoers отсутствует. У заказчика уже имеется некий процесс, который запускается раз в неделю и проверяет контрольную сумму файла для обеспечения безопасности. Хотя в скрипте есть отсылка к Solaris, для этого заказчика нам не пришлось переносить еще и это требование.

Начнем с того, что создадим роль и поместим файл sudoers в Git для контроля версий. Помимо прочего это позволит нам избавиться от необходимости монтирования NFS томов.

С параметрами «validate» и «backup» для модулей copy и template, мы можем избавиться от необходимости написания кода для создания резервных копий и восстановления файла. При этом валидация осуществляется перед тем, как файл будет помещен в точку назначения, и если валидация не проходит, модуль выдает ошибку.

Для каждой роли нам необходимо указать задачи, шаблоны и переменные. Вот как выглядит структура соответствующего файла:

You must be root to run this script

Файл со сценариями ролей (плейбук), sudoers.yml, имеет простую структуру:

Вот содержимое файла vars/main.yml:

В первой строчке мы добавляем следующую команду для управления пробелами и отступами:

Вот код, который вставляет строку include в конце файла:

Теперь переходим к задачам. Во-первых, необходимо установить факт для парсинга имени хоста. Мы будем использовать в условной конструкции факт «parhost».

Кроме того, предстоит решить вопрос с различиями в группах root в AIX и RHEL.

В результате, мы удалили из скрипта все лишнее и создали полностью идемпотентную роль, которая способна обеспечить желаемое состояние файла sudoers. Использование SCM позволяет осуществлять контроль версий, обеспечивает более эффективное управление изменениями и прозрачность. CI/CD с Jenkins или другими инструментами позволяют наладить автоматизированное тестирование кода Ansible для будущих изменений. Роль Auditor в Ansible Tower позволяет контролировать и обеспечивать соблюдение требований организаций.

Из скрипта можно было бы удалить код для работы с контрольными суммами, но для этого заказчику потребовалось бы сначала проконсультироваться со своей службой безопасности. При необходимости шаблон sudoers можно защитить с помощью Ansible Vault. Наконец, использование групп позволяет избежать написания логики с применением includes и excludes.

«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.

Run this script

How i can run this script remove-orphans.sh ?

I have tried the next thing, but displays an error;

$ sh /home/usuari/Descargas/remove-orphans.sh
Error: You must be root to run this script!

Care sharing root account!!

Once you give root access to someone, they could do anything, including editing your script!!

«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 .

«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 ?

You must be root to run this script

«This script must be run as root»

Do I have to enter «sudo ./install» exactly or something like «sudo cd /tmp/antivir/install» ?

Must run as root, but I am already root

Must run as root, but I am already root

#1 Post by bertenvdb » 2015-01-21 16:29

I’m trying to install OpenNMS. I need to execute:

uname -a: Linux kira 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u1 x86_64 GNU/Linux

Re: Must run as root, but I am already root

#2 Post by aicardi » 2015-01-21 17:03

Re: Must run as root, but I am already root

#3 Post by bertenvdb » 2015-01-21 17:09

Re: Must run as root, but I am already root

#4 Post by aicardi » 2015-01-21 17:33

Re: Must run as root, but I am already root

#5 Post by bertenvdb » 2015-01-21 17:48

I wonder what you searched for, I guess you found this on the OpenNMS mailinglist. I have been searching for 2 hours and didn’t come accross that yet.

Re: Must run as root, but I am already root

#6 Post by roseway » 2015-01-21 18:44

Re: Must run as root, but I am already root

#7 Post by dilberts_left_nut » 2015-01-21 18:50

Re: Must run as root, but I am already root

#8 Post by schnuller » 2015-01-21 21:35

Perhaps try
su —
too. Which usually should be done, i was told, but as i get away without doing it .

Re: Must run as root, but I am already root

#9 Post by bertenvdb » 2015-01-22 01:25

Will post a topic on OpenNMS as soon as I wake up in the morning.

Thanks for the support !

For reference or curious people:

Re: Must run as root, but I am already root

#10 Post by fsmithred » 2015-01-22 13:23

FWIW, here’s another way to do the same test:

Re: Must run as root, but I am already root

#11 Post by impensj » 2016-07-05 17:24

The script expects the `id` command to return a line containing uid= but gets a line containing UID= instead.

8 Answers 8

The only way I could think of is to check one of the SUDO_* environment variables set by sudo:

Notice that of course this solution is not future proof as you cannot stop anyone from setting a variable before running the script:

You must be root to run this script

Another option would be to check if the grandparent process name is «sudo»:

The script to check for real root (if auditctl —loginuid-immutable is set) could look like

8 Answers 8

The only way I could think of is to check one of the SUDO_* environment variables set by sudo:

Notice that of course this solution is not future proof as you cannot stop anyone from setting a variable before running the script:

You must be root to run this script

Another option would be to check if the grandparent process name is «sudo»:

The script to check for real root (if auditctl —loginuid-immutable is set) could look like

«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 ?! You must be root to run this script

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

«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 ?

You must be root to run this script

«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 ?

You must be root to run this script

«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 ?! You must be root to run this script

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

Allow bash script to be run as root, but not sudo

I’m new here and new to bash/linux.

This is what I have:

Regarding logname

Have a look at correct Stéphane Chazelas’s answer! This could be the best answer for a homework!!

«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 .

First quick way using pstree

So simplier way to search for sudo presence in whole current tree, seem to use pstree:

die() { echo >&2 ${0##*/} Error: "$@"; exit 1;}
pstree -s $$ | grep -q '\bsudo\b' && die "Can't be run under sudo"

Amazon EC2 set-up failure #10

First, before you have the script running, it’s necessary to install a software called docker on Amazon EC2 Ubuntu system, where docker is not pre-installed.
Second, it doesn’t work. After running the script, the server doesn’t show any api. It stopped at «starting Watchtower. OK», which is obviously not OK.

The text was updated successfully, but these errors were encountered:

Thanks for the feedback, and sorry for your trouble.

When you run docker ps , does it show a shadowbox container? That’s the core of the service.

You can get the JSON needed to set up the Server Manager with

If you’d like to try again, the server installation on EC2 was tested using the image ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20180126 — ami-66506c1c (from Community AMIs)

What we did to get it working was:

Under «Configure Security Group», added a «Custom TCP Rule» and a «Custom UDP Rule». Set the Port Range for both to 1024-65535 , and Source to 0.0.0.0/0

  1. SSH in as user «unbuntu»
  2. curl -sS https://get.docker.com/ | sh
  3. sudo usermod -aG docker $USER

Because «ufw status» requires «sudo», we accidentally think that ufw is enabled when it is not by default

Could you try that and let us know if it still doesn’t work?

«This script must be run as root»

Thread Tools
Display

Run this script

yes, i tried this, but i have not seen any result.

Now I dont know if not runs this instruction or script is incorrect

«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»

Please post back if you have any further questions or comments.

«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»

Please post back if you have any further questions or comments.

Workaround for executing this by using sudo anyway

But all this is someting fragile:

$ sudo su -
# screen -D -R  # apt install screen if not installed
$ sudo screen -x

Now, you’ll be logged in a root login session. No trace of any sudo.

# ps $PPID
 PID TTY      STAT   TIME COMMAND
 26367 ?        Ss     0:00 SCREEN -D -R
# ps ho ppid $PPID
 1
# set | grep SUDO
                                         # <-- nothing here!

«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.

Run this script

Could you give us the exact command you give and the exact message you get from terminal, along with the exact script content you’re trying to execute?

You must be root to run this script

Must run as root, but I am already root

Must run as root, but I am already root

#1 Post by bertenvdb » 2015-01-21 16:29

I’m trying to install OpenNMS. I need to execute:

uname -a: Linux kira 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u1 x86_64 GNU/Linux

Re: Must run as root, but I am already root

#2 Post by aicardi » 2015-01-21 17:03

Re: Must run as root, but I am already root

#3 Post by bertenvdb » 2015-01-21 17:09

Re: Must run as root, but I am already root

#4 Post by aicardi » 2015-01-21 17:33

Re: Must run as root, but I am already root

#5 Post by bertenvdb » 2015-01-21 17:48

I wonder what you searched for, I guess you found this on the OpenNMS mailinglist. I have been searching for 2 hours and didn’t come accross that yet.

Re: Must run as root, but I am already root

#6 Post by roseway » 2015-01-21 18:44

Re: Must run as root, but I am already root

#7 Post by dilberts_left_nut » 2015-01-21 18:50

Re: Must run as root, but I am already root

#8 Post by schnuller » 2015-01-21 21:35

Perhaps try
su —
too. Which usually should be done, i was told, but as i get away without doing it .

Re: Must run as root, but I am already root

#9 Post by bertenvdb » 2015-01-22 01:25

Will post a topic on OpenNMS as soon as I wake up in the morning.

Thanks for the support !

For reference or curious people:

Re: Must run as root, but I am already root

#10 Post by fsmithred » 2015-01-22 13:23

FWIW, here’s another way to do the same test:

Re: Must run as root, but I am already root

#11 Post by impensj » 2016-07-05 17:24

The script expects the `id` command to return a line containing uid= but gets a line containing UID= instead.

«This script must be run as root»

Thread Tools
Display

«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.

Allow bash script to be run as root, but not sudo

I’m new here and new to bash/linux.

This is what I have:

Regarding comment about renamed sudo

If sudo command is renamed or copied, then instead of looking for command name, look for UID in whole parent tree. So script is same than previous, but searching for UID >= 1000 in parent tree:

die() { echo >&2 ${0##*/} Error: "$@"; exit 1;}
pid=$$
while read pid uid < <(ps ho ppid,uid $pid) && ((pid>1));do
    ((uid>999)) && die "Can't be run under sudo"
done

Because we are speaking about Un*x

To be correct, avoid using fixed statical datas, use of UID_MIN from /etc/login.defs:

die() { echo >&2 ${0##*/} Error: "$@"; exit 1;}
while read fld val;do
    case $fld in UID_MIN ) UIDMIN=$val ;break ;; esac
done </etc/login.defs
((UIDMIN)) || die Getting UID_MIN.
pid=$$
while read pid uid < <(ps ho ppid,uid $pid) && ((pid>1));do
    (( uid >= UIDMIN )) && die "Can't be run under sudo"
done

With ps only, you could loop over ps ho ppid

die() { echo >&2 ${0##*/} Error: "$@"; exit 1;}
pid=$$
while read pid name foo < <(ps ho ppid,cmd $pid) && ((pid>1));do
    [ "$name" = "sudo" ] && die "Can't be run under sudo"
done

Run this script

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 ?

You must be root to run this script

Run this script

yes, i tried this, but i have not seen any result.

Now I dont know if not runs this instruction or script is incorrect

It won’t output anything. The script does it all in the background.

So then for all those items it’ll purge it from dpkg cache.

Must run as root, but I am already root

Must run as root, but I am already root

#1 Post by bertenvdb » 2015-01-21 16:29

I’m trying to install OpenNMS. I need to execute:

uname -a: Linux kira 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u1 x86_64 GNU/Linux

Re: Must run as root, but I am already root

#2 Post by aicardi » 2015-01-21 17:03

Re: Must run as root, but I am already root

#3 Post by bertenvdb » 2015-01-21 17:09

Re: Must run as root, but I am already root

#4 Post by aicardi » 2015-01-21 17:33

Re: Must run as root, but I am already root

#5 Post by bertenvdb » 2015-01-21 17:48

I wonder what you searched for, I guess you found this on the OpenNMS mailinglist. I have been searching for 2 hours and didn’t come accross that yet.

Re: Must run as root, but I am already root

#6 Post by roseway » 2015-01-21 18:44

Re: Must run as root, but I am already root

#7 Post by dilberts_left_nut » 2015-01-21 18:50

Re: Must run as root, but I am already root

#8 Post by schnuller » 2015-01-21 21:35

Perhaps try
su —
too. Which usually should be done, i was told, but as i get away without doing it .

Re: Must run as root, but I am already root

#9 Post by bertenvdb » 2015-01-22 01:25

Will post a topic on OpenNMS as soon as I wake up in the morning.

Thanks for the support !

For reference or curious people:

Re: Must run as root, but I am already root

#10 Post by fsmithred » 2015-01-22 13:23

FWIW, here’s another way to do the same test:

Re: Must run as root, but I am already root

#11 Post by impensj » 2016-07-05 17:24

The script expects the `id` command to return a line containing uid= but gets a line containing UID= instead.

About /proc/self/loginuid under Linux

Please read interesting laolux’s answer about this!

die() { echo >&2 ${0##*/} Error: "$@"; exit 1;}
read lUid </proc/self/loginuid || die "Can't access procfile"
((lUid)) && die "You must be logged as root."

( This syntax avoid forks! )

  • script could be copied and edited
  • depending on config/kernel, this kernel entry could be spoofed
  • Sudoer could create cron entry for initiating special screen session as root. (cron and screen are not the only way for doing things like this! Just the first coming to my mind. )

Please help me #21

The text was updated successfully, but these errors were encountered:

type apt-get install fcrackzip and install it

what a question . xD

Type: sudo apt-get install fcrackzip

type apt-get install fcrackzip and install it

Hey i have tried using the sudo command

can u please help me resolve this issue

Maybe your repositories are a bit outdated.

If you are using ubuntu terminal on windows, Try using

i need help for the fcrackzip install

did you solve it out
.

what Should i do

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Conclusion

As chepner rightly commented: sudo is drawn to give specifics access to specifics tools:

Nothing about sudo requires it to give you root access; that’s just the default behavior everyone is familiar with. sudo can be configured to allow you to do only very specific things, including not gain root access at all – chepner

Care to configure them correctly, before using fragile workaround!

apropos sudo

And read carefully

man sudo.conf
man sudoers

Дополнительно:  King Root v5.4.0
Оцените статью
Master Hi-technology
Добавить комментарий