пример: рассмотрим этот рабочий скрипт, который пытается взаимодействовать с postgres + избегать пакетов pip (поскольку он не root, он зависает на неопределенный срок):
ок, это было в 2022 году https://arstechnica.com/information-tec ... 2022/08/10 -malicious-python-packages-expose-in-latest-repository-attack/ и эти разработчики, вероятно, заслуживают доверия https://pypi.org/user/jerickso/ https://pypi.org/user/piro/, но все же X-D
это так сложно?
Код: Выделить всё
hostnamectl |grep Op; # tested on, Debian is more minimalistic faster!!! :D
Код: Выделить всё
Operating System: Ubuntu 22.04.4 LTS
Код: Выделить всё
vim /home/user/git/test/test_db.py
Код: Выделить всё
import subprocess
print("=== python: how to interact with postgres without 3rd party pip packages v1.0 ===")
# Define the command to be executed
command = 'sudo -u postgres psql -c "SELECT version();"'
# Execute the command using subprocess
try:
result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
print("Output:")
print(result.stdout)
except subprocess.CalledProcessError as e:
print(f"Error: {e}")
print(f"Command output (stderr): {e.stderr}")
PS: тоже уже вмешивался в sudo
на данный момент единственный рабочее решение: D
запустите eclipse от имени пользователя root без sudo
Код: Выделить всё
vim /script/start_eclipse_as_root.sh
Код: Выделить всё
#!/bin/bash
Код: Выделить всё
export DISPLAY=':0.0'
Код: Выделить всё
cp -v /home/user/.Xauthority /root/.Xauthority
Код: Выделить всё
/home/user/eclipse/eclipse/eclipse
Интересно, есть ли более элегантный способ
PS: пожалуйста, сделайте stackoverflow.com максимально простым
Подробнее здесь: https://stackoverflow.com/questions/786 ... on-without