Error this script can only be executed by root

Здравствуйте, взял пробный 30-дневный период VPS у GoDaddy и пытаюсь установить Vesta на Centos и Debian через ssh. У меня возникло 2 вопроса возможно ли это сделать на данном хостинге, а также когда делаю установку по инструкции https://vestacp.com/ выскакивает ошибка Error: this script can only be executed by root. Подскажите что я делаю не так.Ниже прилагаю скриншоты. Заранее спасибо!

MrMayson

Posts: 2
Joined: Wed Apr 13, 2016 10:04 am

Error: this script can only be executed by root

Здравствуйте, взял пробный 30-дневный период VPS у GoDaddy и пытаюсь установить Vesta на Centos и Debian через ssh. У меня возникло 2 вопроса возможно ли это сделать на данном хостинге, а также когда делаю установку по инструкции https://vestacp.com/ выскакивает ошибка Error: this script can only be executed by root. Подскажите что я делаю не так.Ниже прилагаю скриншоты. Заранее спасибо!

ImageImage


imperio

VestaCP Team
Posts: 6987
Joined: Sat Dec 01, 2012 12:37 pm
Contact:

Re: Error: this script can only be executed by root

Post

by imperio » Wed Apr 13, 2016 12:04 pm

Добрый день.
Вам нужно запускать установщик или от суперпользователя root или от пользователя с правами sudo


MrMayson

Posts: 2
Joined: Wed Apr 13, 2016 10:04 am

Re: Error: this script can only be executed by root

Post

by MrMayson » Thu Apr 14, 2016 2:14 pm

Благодарю за ответ, Вы очень помогли!:)


skurudo

VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:

Re: Error: this script can only be executed by root

Post

by skurudo » Fri Apr 15, 2016 12:02 pm

Ок, тогда закрываем.



  • Печать

Страницы: [1]   Вниз

Тема: VESTA CP  (Прочитано 1874 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
andreik99


Оффлайн
zotkindm

curl -O http://vestacp.com/pub/vst-install.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1721  100  1721    0     0   3032      0 --:--:-- --:--:-- --:--:--  3029

Нормально все

#!/bin/bash
# Vesta installation wrapper
# http://vestacp.com

#
# Currently Supported Operating Systems:
#
#   RHEL 5, RHEL 6
#   CentOS 5, CentOS 6
#   Debian 7
#   Ubuntu LTS, Ubuntu 13.04, Ubuntu 13.10
#

# Am I root?
if [ "x$(id -u)" != 'x0' ]; then
    echo 'Error: this script can only be executed by root'
    exit 1
fi

# Check admin user account
if [ ! -z "$(grep ^admin: /etc/passwd)" ] && [ -z "$1" ]; then
    echo "Error: user admin exists"
    echo
    echo 'Please remove admin user account before proceeding.'
    echo 'If you want to do it automatically run installer with -f option:'
    echo "Example: bash $0 --force"
    exit 1
fi

# Check admin user account
if [ ! -z "$(grep ^admin: /etc/group)" ] && [ -z "$1" ]; then
    echo "Error: group admin exists"
    echo
    echo 'Please remove admin user account before proceeding.'
    echo 'If you want to do it automatically run installer with -f option:'
    echo "Example: bash $0 --force"
    exit 1
fi

# Detect OS
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
    Debian)     type="debian" ;;
    Ubuntu)     type="ubuntu" ;;
    *)          type="rhel" ;;
esac

# Check wget
if [ -e '/usr/bin/wget' ]; then
    wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
    if [ "$?" -eq '0' ]; then
        bash vst-install-$type.sh $*
        exit
    else
        echo "Error: vst-install-$type.sh download failed."
        exit 1
    fi
fi

# Check curl
if [ -e '/usr/bin/curl' ]; then
    curl -O http://vestacp.com/pub/vst-install-$type.sh
    if [ "$?" -eq '0' ]; then
        bash vst-install-$type.sh $*
        exit
    else
        echo "Error: vst-install-$type.sh download failed."
        exit 1
    fi
fi

exit

Содержимое если что

« Последнее редактирование: 22 Октября 2016, 11:50:09 от zotkindm »


Оффлайн
AnrDaemon

Смотрите, какая милота… Может, ещё через судо это запустить предложите?
Впрочем, в свете CVE-2016-5195, даже sudo не нужно…

« Последнее редактирование: 22 Октября 2016, 15:33:14 от AnrDaemon »

Хотите получить помощь? Потрудитесь представить запрошенную информацию в полном объёме.

Прежде чем [Отправить], нажми [Просмотр] и прочти собственное сообщение. Сам-то понял, что написал?…


  • Печать

Страницы: [1]   Вверх

Следовал инструкции установки: создаём 2 файлика с ключами, с именем домена и расширением (.crt, .key). Отредактировал конфиг сайта nginx, выдаёт:

Failed to start a High perfomance web server and a reverse proxy server

Смотрю логи nginx, пишет, что в файле, которого я не трогал ни разу, ошибка:

"if" directive is not allowed here in /etc/nginx/sites-enabled/vst-install.sh:15

Где искать причину — в nginx конф. или в vst-instakk.sh? Скину оба файлика…
Конфиг сайта:

server {
	listen 443 ssl;
	ssl_certificate /etc/ssl/premsite.ru.crt;
	ssl_certificate_key /etc/ssl/premsite.ru.key;
	root /var/www/sites/projects/Business/public_html;
	set $php_sock unix:/var/run/php/php7.3-fpm.sock;
	index index.html index.htm index.php;

	server_name premsite.ru;

	location / {
		try_files $uri $uri/ =404;
	}
	location ~* ^.+.(jpg|jpeg|gif|png|ico|tiff|css|js)$ {
		expires 6M;
		add_header Cache-Control public;
	}
	location ~ .php$ {
        	include snippets/fastcgi-php.conf;
        	fastcgi_pass $php_sock;
        	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

vst-install.sh:

#!/bin/bash
# Vesta installation wrapper
# http://vestacp.com

#
# Currently Supported Operating Systems:
#
#   RHEL 5, 6, 7
#   CentOS 5, 6, 7
#   Debian 7, 8
#   Ubuntu 12.04 - 18.04
#

# Am I root?
if [ "x$(id -u)" != 'x0' ]; then
    echo 'Error: this script can only be executed by root'
    exit 1
fi

# Check admin user account
if [ ! -z "$(grep ^admin: /etc/passwd)" ] && [ -z "$1" ]; then
    echo "Error: user admin exists"
    echo
    echo 'Please remove admin user before proceeding.'
    echo 'If you want to do it automatically run installer with -f option:'
    echo "Example: bash $0 --force"
    exit 1
fi

# Check admin group
if [ ! -z "$(grep ^admin: /etc/group)" ] && [ -z "$1" ]; then
    echo "Error: group admin exists"
    echo
    echo 'Please remove admin group before proceeding.'
    echo 'If you want to do it automatically run installer with -f option:'
    echo "Example: bash $0 --force"
    exit 1
fi

# Detect OS
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
    Debian)     type="debian" ;;
    Ubuntu)     type="ubuntu" ;;
    Amazon)     type="amazon" ;;
    *)          type="rhel" ;;
esac

# Check wget
if [ -e '/usr/bin/wget' ]; then
    wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
    if [ "$?" -eq '0' ]; then
        bash vst-install-$type.sh $*
        exit
    else
        echo "Error: vst-install-$type.sh download failed."
        exit 1
    fi
fi

# Check curl
if [ -e '/usr/bin/curl' ]; then
    curl -O http://vestacp.com/pub/vst-install-$type.sh
    if [ "$?" -eq '0' ]; then
        bash vst-install-$type.sh $*
        exit
    else
        echo "Error: vst-install-$type.sh download failed."
        exit 1
    fi
fi

exit

До SSL всё было хорошо.

Permalink

Cannot retrieve contributors at this time


This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters

Show hidden characters

#!/bin/bash
# Vesta installation wrapper
# http://vestacp.com
#
# Currently Supported Operating Systems:
#
# RHEL 5, RHEL 6
# CentOS 5, CentOS 6
# Debian 7
# Ubuntu LTS, Ubuntu 13.04, Ubuntu 13.10
#
# Am I root?
if [ «x$(id -u)« != x0 ]; then
echo Error: this script can only be executed by root
exit 1
fi
# Check admin user account
if [ ! -z «$(grep ^admin: /etc/passwd)« ] && [ -z «$1« ]; then
echo «Error: user admin exists«
echo
echo Please remove admin user account before proceeding.
echo If you want to do it automatically run installer with -f option:
echo «Example: bash $0 —force«
exit 1
fi
# Check admin user account
if [ ! -z «$(grep ^admin: /etc/group)« ] && [ -z «$1« ]; then
echo «Error: group admin exists«
echo
echo Please remove admin user account before proceeding.
echo If you want to do it automatically run installer with -f option:
echo «Example: bash $0 —force«
exit 1
fi
# Detect OS
case $(head -n1 /etc/issue | cut -f 1 -d ) in
Debian) type=«debian« ;;
Ubuntu) type=«ubuntu« ;;
*) type=«rhel« ;;
esac
# Check curl
if [ -e /usr/bin/curl ]; then
curl -O http://vestacp.com/pub/vst-install-$type.sh
if [ «$?« -eq 0 ]; then
echo sed -i «s/php54/php%PHP_Server_version%/g» /etc/yum.repos.d/remi.repo
sed -i «s/php55/php%PHP_Server_version%/g» /etc/yum.repos.d/remi.repo
sed -i «s/php56/php%PHP_Server_version%/g» /etc/yum.repos.d/remi.repo > tmp.txt
sed -i /remi.repo/r tmp.txt vst-install-$type.sh
rm -f tmp.txt
d=vesta,remi*; c=vesta,remi,remi-php%PHP_Server_version%,mariadb
sed -i «s#$d#$c#g« vst-install-$type.sh
remove81=«remi-php81.repo«
sed -i «/.*$remove81.*/d« vst-install-$type.sh
MariaDB_Server_version=%MariaDB_Server_version%
if [ «$MariaDB_Server_version« != «5.5« ]; then
d=mariadb mariadb-server; c=MariaDB-server MariaDB-client
sed -i «s#$d#$c#g« vst-install-$type.sh
fi
bash vst-install-$type.sh $*
exit
else
echo «Error: vst-install-$type.sh download failed.«
exit 1
fi
fi
exit

I’m on Ubuntu 16 and I’d like to add a neo4j package. I tried in 3 ways all leading to the same error.

These are my attempts:

wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

sudo wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

sudo -i wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

But I always get this error message:

ERROR: This command can only be used by root.
--2016-11-04  http://debian.neo4j.org/neotechnology.gpg.key
Resolving debian.neo4j.org (debian.neo4j.org)... 52.0.233.188
Connecting to debian.neo4j.org (debian.neo4j.org)|52.0.233.188|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4791 (4,7K) [application/octet-stream]
Saving to: ‘STDOUT’

-                     0%[                    ]       0  --.-KB/s    in 0s      


Cannot write to ‘-’ (Broken pipe).

asked Nov 4, 2016 at 15:29

splunk's user avatar

You need to change your wget command from:

wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

to:

wget -O - http://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -

answered Nov 4, 2016 at 15:37

heynnema's user avatar

heynnemaheynnema

66.1k13 gold badges115 silver badges170 bronze badges

1

The error message is from apt-key, and as it says, use it with sudo:

wget -O - http://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -

answered Nov 4, 2016 at 16:01

muru's user avatar

murumuru

189k52 gold badges460 silver badges711 bronze badges

2

Понравилась статья? Поделить с друзьями:
  • Error this file requires compiler and library support for the
  • Error this constructor was not compatible with dependency injection
  • Error this command is not available when running the angular cli outside a workspace
  • Error this build is outdated spigot как убрать
  • Error this asset has a trainz build number which is not recognised by this tool