You are not logged in.

#1 2024-04-19 15:04:55

ronibastos2023
Member
Registered: 2023-09-21
Posts: 7

Alguém pode me ajudar porfavor como executar comandos ao iniciar no i3

Alguém pode me ajudar porfavor como executar comandos ao iniciar no i3wm sem pedir a senha?
Can anyone please help me how to execute commands when starting in i3wm without asking for the password?

vim .config/i3/config

exec --no-startup-id alacritty -e sudo apt autoremove
exec --no-startup-id alacritty -e sudo apt autoclean
exec --no-startup-id alacritty -e sudo apt install -f
exec --no-startup-id alacritty -e sudo apt update && -e sudo apt upgrade
exec --no-startup-id alacritty -e sudo apt update
exec --no-startup-id alacritty -e sudo apt upgrade
exec --no-startup-id alacritty -e sudo apt full-upgrade

Offline

#2 2024-04-19 15:09:15

seth
Member
Registered: 2012-09-03
Posts: 59,158

Re: Alguém pode me ajudar porfavor como executar comandos ao iniciar no i3

"man sudoers", you probably also want to chain that in one script instead of running multiple instances of apt in parallel.
Also Ubuntu isn't supported here and unless you're posting in the foreign language board, the subject needs to be english.

Offline

#3 2024-04-19 15:18:52

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,117
Website

Re: Alguém pode me ajudar porfavor como executar comandos ao iniciar no i3

Mod note: Moving to Other Languages as per the language of the thread's title.


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#4 2024-04-20 02:43:59

ronibastos2023
Member
Registered: 2023-09-21
Posts: 7

Re: Alguém pode me ajudar porfavor como executar comandos ao iniciar no i3

I found the ideal solution for this problem on the github forum with the help of "
Wesley Schwengle", follow his message below, it worked for me!

You can use this boilerplate. I allow users in the sudoers group to do safe operations without a password. There is a potentially unsafe bit with dist-upgrades (full-upgrades), but since I feel my people have knowledge, I also allow this to be passwordless. Anything else requires a password. Feel free to change it to your liking.

# Place this in a file in /etc/sudoers.d/002-apt
#
# Allow apt to run without sudo password for some common operations
Cmd_Alias APT_UPDATE = /usr/bin/aptitude update, /usr/bin/apt-get update, /usr/bin/apt update, /usr/bin/apt-file update
Cmd_Alias APT_UPGRADE = /usr/bin/aptitude safe-upgrade, /usr/bin/apt-get upgrade, /usr/bin/apt upgrade, /usr/bin/aptitude safe-upgrade --no-new-installs

# These are potentially removing things, but are generally safe and needed for upgrades
Cmd_Alias APT_DUPGRADE = /usr/bin/aptitude full-upgrade, /usr/bin/apt-get dist-upgrade, /usr/bin/apt full-upgrade
Cmd_Alias APT_CLEAN = /usr/bin/aptitude clean, /usr/bin/apt-get clean, /usr/bin/apt clean
Cmd_Alias APT_AUTOCLEAN = /usr/bin/aptitude autoclean, /usr/bin/apt-get autoclean, /usr/bin/apt autoclean
Cmd_Alias APT_AUTOREMOVE = /usr/bin/aptitude autoremove, /usr/bin/apt-get autoremove, /usr/bin/apt autoremove

%sudo   ALL=(ALL:ALL) NOPASSWD: APT_UPDATE
%sudo   ALL=(ALL:ALL) NOPASSWD: APT_UPGRADE
%sudo   ALL=(ALL:ALL) NOPASSWD: APT_DUPGRADE
%sudo   ALL=(ALL:ALL) NOPASSWD: APT_CLEAN
%sudo   ALL=(ALL:ALL) NOPASSWD: APT_AUTOCLEAN
%sudo   ALL=(ALL:ALL) NOPASSWD: APT_AUTOREMOVE

Offline

#5 2024-04-20 07:13:04

seth
Member
Registered: 2012-09-03
Posts: 59,158

Re: Alguém pode me ajudar porfavor como executar comandos ao iniciar no i3

So instead of looking up the manpage you copy-pasted something you don't understand from the internet AND IT WORKED!!

%sudo   ALL=(ALL:ALL) NOPASSWD: APT_UPDATE

I guess that fits, but ubuntu is still not supported here.

Offline

Board footer

Powered by FluxBB