Strona 1 z 1

echo data - Permission denied

: 07 mar 2021, 17:09
autor: Szogi1910
Hejm korzystam z ubuntu 20.04 na vpsie i mam malutki problem, muszę na nim wykonać polecenie

Kod: Zaznacz cały

 sudo echo 'www-data ALL=NOPASSWD: ALL' >> /etc/sudoers
W tym celu dodałem użytkownika do grupy sudo, lecz gdy wykonuje polecenie otrzymuje błąd o braku uprawnień, czy znajdzie się tutaj jakaś dusza która pomoże mi rozwiązać owy problem

Kod: Zaznacz cały

 sudo echo 'www-data ALL=NOPASSWD: ALL' >> /etc/sudoers
-bash: /etc/sudoers: Permission denied

Re: echo data - Permission denied

: 07 mar 2021, 20:16
autor: kobrawerde

Re: echo data - Permission denied

: 08 mar 2021, 19:47
autor: Szogi1910
Niestety to nie rozwiązało mojego problemu, dodam że wykonuje to z użytkownika nie z roota

Kod: Zaznacz cały

$ ls -l /etc/sudoers
-rwxr-xr-x 1 root root 788 Mar  7 20:25 /etc/sudoers
$  ls -ld /etc
drwxr-xr-x 106 root root 4096 Mar  7 20:58 /etc
 ls -ld /
drwxr-xr-x 19 root root 4096 Mar  7 20:21 /
/etc/sudouers

Kod: Zaznacz cały

# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root	ALL=(ALL:ALL) ALL
user	ALL=(ALL) NOPASSWD: ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

Re: echo data - Permission denied

: 08 mar 2021, 20:57
autor: kobrawerde

Kod: Zaznacz cały

sudo sh -c "echo 'www-data ALL=NOPASSWD: ALL' >> /etc/sudoers"

Re: echo data - Permission denied

: 08 mar 2021, 20:59
autor: Wunder Wungiel
a jak zrobisz

Kod: Zaznacz cały

sudo passwd root
i ustawisz hasło dla roota dowolne:
potem dajesz wpisujesz to hasło dla roota
i wpisujesz swoją komendę bez sudo

Re: echo data - Permission denied

: 08 mar 2021, 21:01
autor: Wunder Wungiel
To pójdzie?

Re: echo data - Permission denied

: 09 mar 2021, 20:08
autor: Szogi1910
kobrawerde pisze: 08 mar 2021, 20:57

Kod: Zaznacz cały

sudo sh -c "echo 'www-data ALL=NOPASSWD: ALL' >> /etc/sudoers"
Jesteś moim zbawcą