Hello,
i’m using a small pc as a computer to host servers on. I’m using Garuda on it, like on my main computer.
I’ve been searching the web for days now, because I wanna automate as much as possible on this server pc, including updating and restarting. Since these two commands ask for a password, i’ve been searching for ways to execute a script with these two commands (pacman -Syu --noconfirm && shutdown -r 15
) without needing to put in a password.
I’ve always been finding the same thing in different variations, which is: Editing the sudoers-file with visudo. Which I did in all variations I found. My additions to this file are atm these:
[username] ALL=(ALL) NOPASSWD: /home/[username]/root-scripts/update-and-restart.sh
[username] ALL=(ALL) NOPASSWD: /home/[username]/root-scripts/
Following the most upvoted answer here, I also put sudo chown root:root
and sudo chmod 700
on the folder “root-scripts” and the file “update-and-restart.sh” - although that didn’t seem to change the outcome in the slightest.
I’ve also been here, here and here (not including the tabs I already closed), but to no avail. It doesn’t matter if I run my script and it tries to execute sudo /home/[username]/root-scripts/update-and-restart.sh
or if I do it myself in the console: It asks for my password.
It doesn’t seem to be the “root-scripts” folder either, since that’s just a late addition in trying to fix this problem. I’ve also run sudo visudo -c
, had some permission problems, changed the files to 0440 (as instructed by visudo), everything’s parsed OK
now, but I still can’t run that script without being asked for the password.
I’m completely at my wits end here. I refuse(d) to supply the password via the script, since it’s a python script and my password would be saved in basically clear text, which to me sounds like a huge security issue on a server pc. But the correct way of doing it just, straight up, ain’t doin’ it for some unknown reason.
When trying to execute /home/[username]/root-scripts/update-and-restart.sh
(so without the sudo
in front), I get zsh: permission denied: /home/[username]/root-scripts/update-and-restart.sh
- could this have something to do with the problem or is this irrelevant?
Thanks to everyone in advance for reading and for your help.
garuda-inxi:
System:
Kernel: 6.12.34-1-lts arch: x86_64 bits: 64 compiler: gcc v: 15.1.1
clocksource: tsc avail: hpet,acpi_pm
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-lts
root=UUID=e2c7e3c3-c687-4aea-b5c4-92149b9abd86 rw rootflags=subvol=@
quiet resume=UUID=b48b0442-80f9-4b1d-829e-4abfe9010e8b loglevel=3 ibt=off
Desktop: Xfce v: 4.20.1 tk: Gtk v: 3.24.48 wm: xfwm4 v: 4.20.0
with: xfce4-panel tools: xfce4-screensaver avail: xautolock vt: 7
dm: LightDM v: 1.32.0 Distro: Garuda base: Arch Linux
Machine:
Type: Desktop System: GEEKOM product: AE8 v: N/A
serial: <superuser required>
Mobo: N/A model: AE8 serial: <superuser required> part-nu: GEEKOM AE8
uuid: <superuser required> UEFI: American Megatrends LLC. v: 0.45
date: 04/07/2024
CPU:
Info: model: AMD Ryzen 7 8845HS w/ Radeon 780M Graphics bits: 64
type: MT MCP arch: Zen 4 gen: 4 level: v4 note: check built: 2022+
process: TSMC n5 (5nm) family: 0x19 (25) model-id: 0x75 (117) stepping: 2
microcode: 0xA705206
Topology: cpus: 1x dies: 1 clusters: 1 cores: 8 threads: 16 tpc: 2
smt: enabled cache: L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 8 MiB
desc: 8x1024 KiB L3: 16 MiB desc: 1x16 MiB
Speed (MHz): avg: 1468 min/max: 400/5137 boost: enabled scaling:
driver: amd-pstate-epp governor: performance cores: 1: 1468 2: 1468 3: 1468
4: 1468 5: 1468 6: 1468 7: 1468 8: 1468 9: 1468 10: 1468 11: 1468 12: 1468
13: 1468 14: 1468 15: 1468 16: 1468 bogomips: 121419
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Vulnerabilities: <filter>
Graphics:
Device-1: Advanced Micro Devices [AMD/ATI] Phoenix3 driver: amdgpu v: kernel
arch: RDNA-3 code: Phoenix process: TSMC n4 (4nm) built: 2023+ pcie: gen: 4
speed: 16 GT/s lanes: 16 ports: active: HDMI-A-2 empty: DP-1, DP-2, DP-3,
DP-4, DP-5, DP-6, HDMI-A-1, Writeback-1 bus-ID: 65:00.0 chip-ID: 1002:1900
class-ID: 0300 temp: 47.0 C
Display: x11 server: X.Org v: 21.1.18 compositor: xfwm4 v: 4.20.0 driver:
X: loaded: amdgpu unloaded: modesetting alternate: fbdev,vesa dri: radeonsi
gpu: amdgpu display-ID: :0.0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 509x286mm (20.04x11.26")
s-diag: 584mm (22.99")
Monitor-1: HDMI-A-2 mapped: HDMI-A-1 model: Asus VG248 serial: <filter>
built: 2014 res: mode: 1920x1080 hz: 60 scale: 100% (1) dpi: 92 gamma: 1.2
size: 531x299mm (20.91x11.77") diag: 609mm (24") ratio: 16:9 modes:
max: 1920x1080 min: 720x400
API: Vulkan v: 1.4.313 layers: 7 device: 0 type: integrated-gpu name: AMD
Radeon 780M Graphics (RADV PHOENIX) driver: mesa radv v: 25.1.4-arch1.1
device-ID: 1002:1900 surfaces: N/A device: 1 type: cpu name: llvmpipe
(LLVM 20.1.6 256 bits) driver: mesa llvmpipe v: 25.1.4-arch1.1 (LLVM
20.1.6) device-ID: 10005:0000 surfaces: N/A
API: OpenGL Message: Unable to show GL data. glxinfo is missing.
Info: Tools: api: vulkaninfo de: xfce4-display-settings
x11: xdpyinfo, xprop, xrandr
Audio:
Device-1: Advanced Micro Devices [AMD/ATI] Radeon High Definition Audio
[Rembrandt/Strix] driver: snd_hda_intel v: kernel pcie: gen: 4
speed: 16 GT/s lanes: 16 bus-ID: 65:00.1 chip-ID: 1002:1640 class-ID: 0403
Device-2: Advanced Micro Devices [AMD] Family 17h/19h/1ah HD Audio
driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
bus-ID: 65:00.6 chip-ID: 1022:15e3 class-ID: 0403
API: ALSA v: k6.12.34-1-lts status: kernel-api tools: N/A
Server-1: PipeWire v: 1.4.5 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: Realtek RTL8125 2.5GbE driver: r8169 v: kernel pcie: gen: 2
speed: 5 GT/s lanes: 1 port: f000 bus-ID: 01:00.0 chip-ID: 10ec:8125
class-ID: 0200
IF: enp1s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
Device-2: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter
vendor: AzureWave driver: mt7921e v: kernel pcie: gen: 2 speed: 5 GT/s
lanes: 1 bus-ID: 02:00.0 chip-ID: 14c3:7922 class-ID: 0280
IF: wlp2s0 state: down mac: <filter>
Info: services: NetworkManager, nfsd, smbd, systemd-timesyncd,
wpa_supplicant
Bluetooth:
Device-1: IMC Networks Wireless_Device driver: btusb v: 0.8 type: USB
rev: 2.1 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-1:2 chip-ID: 13d3:3585
class-ID: e001 serial: <filter>
Report: btmgmt ID: hci0 rfk-id: 0 state: down bt-service: enabled,running
rfk-block: hardware: no software: yes address: N/A
Drives:
Local Storage: total: 476.94 GiB used: 25.89 GiB (5.4%)
SMART Message: Required tool smartctl not installed. Check --recommends
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Kingston model: OM8PGP4512N-A0
size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
lanes: 4 tech: SSD serial: <filter> fw-rev: ELFK7N.7 temp: 41.9 C
scheme: GPT
Partition:
ID-1: / raw-size: 442.94 GiB size: 442.94 GiB (100.00%)
used: 25.89 GiB (5.8%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 616 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 442.94 GiB size: 442.94 GiB (100.00%)
used: 25.89 GiB (5.8%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-4: /var/log raw-size: 442.94 GiB size: 442.94 GiB (100.00%)
used: 25.89 GiB (5.8%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 442.94 GiB size: 442.94 GiB (100.00%)
used: 25.89 GiB (5.8%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
ID-1: swap-1 type: zram size: 30.63 GiB used: 0 KiB (0.0%) priority: 100
comp: zstd avail: lzo-rle,lzo,lz4,lz4hc,deflate,842 max-streams: 16
dev: /dev/zram0
ID-2: swap-2 type: partition size: 33.7 GiB used: 0 KiB (0.0%)
priority: -2 dev: /dev/nvme0n1p3 maj-min: 259:3
Sensors:
System Temperatures: cpu: 53.0 C mobo: N/A gpu: amdgpu temp: 49.0 C
Fan Speeds (rpm): N/A
Info:
Memory: total: 32 GiB note: est. available: 30.63 GiB used: 7.02 GiB (22.9%)
Processes: 461 Power: uptime: 20m states: freeze,mem,disk suspend: s2idle
wakeups: 0 hibernate: platform avail: shutdown, reboot, suspend, test_resume
image: 12.23 GiB services: upowerd,xfce4-power-manager Init: systemd
v: 257 default: graphical tool: systemctl
Packages: pm: pacman pkgs: 1583 libs: 465 tools: pamac,paru Compilers:
gcc: 15.1.1 Shell: garuda-inxi default: Zsh v: 5.9
running-in: xfce4-terminal inxi: 3.3.38
Garuda (2.7.2-1):
System install date: 2024-11-01
Last full system update: 2025-06-24
Is partially upgraded: No
Relevant software: snapper NetworkManager dracut
Windows dual boot: No/Undetected
Failed units: