Questions tagged [sudo]
sudo - Execute a command with superuser privileges.
2,536 questions
0
votes
0
answers
14
views
Asynchronous execution of sudo in parallel breaks terminal
Why does the following line break the terminal when executed in a non-interactive shell, but doesn't have the same effect when executed in an interactive shell?
for i in {1..10}; do sudo -u testuser ...
8
votes
1
answer
461
views
What is the USER= value reported for sudo attempts?
On my Arch system, failed attempts to run sudo cause a line like this to be added to the logs (note the USER=root):
Nov 20 14:59:31 oregano sudo[191472]: bob : user NOT in sudoers ; TTY=pts/26 ; ...
1
vote
0
answers
64
views
Running XFCE on Debian Trixie. Bash history is not saving any sudo commands
Bash history works OK for except for sudo commands.
Code from .bashrc follows.
How can I modify the behaviour to include anything starting with sudo?
NOTE. This behaviour is the same with a brand new ...
2
votes
1
answer
249
views
x2 sudo commands cannot be executed in terminal
I am running a Ubuntu system on my Radxa Zero 3E (single board computer)
Using its GPIO I am driving a 5V LED via an NPN transisitor. Everything works.
For switching it on I use gpioset $(gpiofind ...
-5
votes
1
answer
57
views
Impossible delete install disk macOs.app [closed]
I'm trying to delete "Install macOS Mojave.app" from my Mac using the terminal command sudo rm -r or rm -rf, but it reports root error/illegal option/directory permission restricted, etc.
...
1
vote
2
answers
73
views
`sudo which` command not finding executable that exists in regular user PATH [duplicate]
I'm encountering a confusing behavior with sudo and the which command. An executable is found when running which as a regular user, but not when using sudo which, even though it's accessible when ...
0
votes
0
answers
41
views
Can the guix package manager safely be utilized without sudo?
I am confused about how to utilize Guix on my Debian machine.
Should I run sudo guix install <package> or simply guix install <package>? If the package is more of a system package (i.e. a ...
2
votes
0
answers
64
views
All users obtain root privileges after logging in and are unable to exit, even if they are just regular users [closed]
In the Ubuntu 24.04LTS release, all users (including those not in the sudoers group) who log in and use commands such as whoami, id - un, and view UID will be displayed as root users with root ...
1
vote
1
answer
118
views
Unable to resolve host error when using sudo in Debian WSL
I was trying to update my packages sudo apt update; sudo apt upgrade on a newly created WSL Debian instance but all of the requests to get new repositories failed with this error.
sudo: unable to ...
2
votes
2
answers
132
views
Sudo doesn't work in my C wrapper
I’m trying to write a C wrapper to run a bash process. The goal of this wrapper is to apply a seccomp policy to restrict certain syscalls.
Here is the code:
#define _GNU_SOURCE
#include <stdio.h>...
2
votes
2
answers
171
views
Run firefox as a different user in Kubuntu
I want to run Firefox as different users (Kubuntu 24.04). I've created extra users, then I do
$ xhost +SI:localuser:NEW_USER
$ sudo -u NEW_USER firefox
I get this error message:
/user.slice/user-1000....
2
votes
1
answer
127
views
Shell script run as root fails with "Permission denied" upon calling external programs
I am required to use a program in a git pre-receive hook, which program can only be run as root. The program is called with a variety of arguments determined during runtime (which cannot be ...
11
votes
1
answer
1k
views
Why doesn't visudo, like sudoedit, spawn a text editor as a regular user?
As far as I know, sudoedit gives a user permission to edit a file that is owned and writable by root.
It makes a copy of that file, the copy is owned by the user, and then it spawns a text editor with ...
-1
votes
1
answer
151
views
Make script with chattr -i executable without sudo
I am on Linux Mint 20 with Cinnamon 4.6.7. I would like a non admin user reg to be able to make /etc/resolv.conf mutable without using sudo. So I made this script at /home/reg/make-resolv-conf-mutable....
0
votes
0
answers
31
views
Wildcard not expanding. sudo to blame? [duplicate]
RHEL 8.
$ alias suip
alias suip='sudo -iu postgres'
If I specify the complete filename, the ls command works as expected:
suip ls ~postgres/logs/pgbackrest_2025-04-30_01:00:01_incr.log
/var/lib/...
6
votes
1
answer
181
views
Sudo regex 1.9.16p2 - not working
I installed sudo v1.9.16p2 on a RHEL 9.5 server which should support regex matching. As a test I created a test user (testuser) and created a (simple?) rule in /etc/sudoers for this test user that ...
-2
votes
1
answer
145
views
Password revealed in terminal after empty password attempt [closed]
In Ubuntu (maybe other distros too) terminals it appears that password echoing gets enabled between failed password prompts revealing whatever is being typed (the password most probable).
I ...
12
votes
1
answer
1k
views
Why doesn’t `sudo -E` preserve `PERL5LIB`?
I’m experiencing a strange behavior related to environment variable preservation with sudo on macOS(15.2): sudo -E doesn't preserve the environment variable PERL5LIB.
Reproduction Steps
Set an ...
15
votes
2
answers
5k
views
Why am I known as a user?
I inherited a Linux server; the previous administrator is no longer with our company. I can log in to the server via SSH with my company-wide Microsoft Directory administration user, and it works ...
0
votes
1
answer
573
views
SUDO_ASKPASS: How to use it appropriately correct?
I need to correct a script to mount a USB composition of µSD cards, all luks encrypted devices, with a common lvm on it and inside a fscrypted home backup partition. The idea is to look automatically (...
2
votes
1
answer
234
views
How to configure Debian sudo to prompt for password at the beginning of every login session?
I am running Debian 12 and working on hardening my system. I'm looking at the sudo behavior at the moment.
As expected, if I ssh into the system and run a sudo command, it prompts the first time, but ...
1
vote
3
answers
403
views
sudo vi fails with "Permission denied" after hardening RHEL
I recently hardened my RHEL system, and after that, sudo vi stopped working. When I try to run:
sudo vi test.sh
I get the following error:
/bin/vi: line 23: /usr/libexec/vi: Permission denied
/bin/vi: ...
-1
votes
1
answer
82
views
executing apt commands using sudo in bashrc
I want to do the following sudo commands at startup using .bashrc:
apt update; apt upgrade; apt update (again); apt autoremove
all of which require sudo.
How can I do this at startup using bashrc?
...
0
votes
0
answers
65
views
System lock when shutdown scheduled on Debian
To reproduce this on a Debian device. Simply run the command sudo shutdown -h +5 after confirmation proceed with locking the device.
In the login window you'll get the message:
system is going down. ...
0
votes
1
answer
138
views
PAM USB fails after adding a device and user to the list
I was trying to use 'pam_usbin order to create a physical key for better security within my system. After installingpam_usb` AUR package, and performing the next code (according to the Archwiki docs):...
0
votes
1
answer
150
views
Help - I moved everything in the root directory to a directory of mine
So I was moving some files, I meant:
mv ./* ~/something
But I typed:
mv /* something
Now I can't boot up my computer and I couldn't because me: ls output: -bash: /bin/ls: No such file or directory
...
0
votes
1
answer
172
views
sudo visudo and still command is prompting for password
I am not having success using sudo visudo. I have read this article How to run a specific program as root without a password prompt? and this article sudo: password prompted even when NOPASSWD is set ...
2
votes
2
answers
369
views
How to achieve credential caching with run0 (as with sudo)?
sudo has the pleasant property of allowing one to cache credentials, i.e., if one is to execute multiple administrative commands in a row, there's less mistyping passwords.
Can the same be achieved ...
0
votes
1
answer
130
views
With sudo, why are inline environment variables not read correctly without -E on some systems?
I have a bash script which logs into my bitwarden instance using the bw cli, in the following way:
test.sh:
#!/usr/bin/sh
set -e -o pipefail
bw logout --quiet || true
BW_CLIENTID=$(cat ./credentials....
-5
votes
1
answer
92
views
Linux + is it possible to config super user in sudoers file in order to enable super user run any other script from other ordinary user [duplicate]
I gives user king to be almost super user , and I set the following in /etc/sudoers
king ALL=(ALL) NOPASSWD:ALL
additionally we have other user that called – lincoin ( simple user )
now I ...
0
votes
1
answer
89
views
changed ownership on folders by user that defined in sudoers file
I have the following simple script that changed ownership on folders
more hola_config.sh
#!/bin/bash
chown -R hola:pola /home/darna
chmod -R 775 /home/darna
in /etc/sudoers I added the following ( ...
1
vote
2
answers
146
views
How to make my configuration dotfiles also be loaded for sudo use?
Lets say I do some configuration in my $XDG_CONFIG_HOME (which is /home/user/.config).
If I run micro text editor and it has custom keybindings and custom theme, doing sudo micro will load the default ...
0
votes
1
answer
50
views
can't find user record in sudoers file, yet have a user that can sudo
As a root, have allowed user ubuntu to sudo
sudo usermod -a -G sudo ubuntu
but can't find any record in sudoers file about it - also /etc/sudoers.d/ is empty:
Defaults env_reset
Defaults ...
0
votes
0
answers
225
views
Weird apparmor unix socket denial for sudo
I have a custom SSH server written in go that wraps commands called by the client in apparmor.
One of the profiles confines sudo and what commands it can call. It started failing on a proxmox backup ...
1
vote
1
answer
54
views
sudoers for passwordless sudoedit, except for sudoers
I want to configure passwordless sudoedit, to edit files under /etc with the exception of sudoers files themselves.
I tried using the following /etc/sudoers.d/sudoedit:
%sudo ALL=(root) NOPASSWD: ...
0
votes
1
answer
108
views
As root user, why do most commands fail unless sudo is used?
why is this happening?
Expected output:
# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500......
Output that occurs:
# ifconfig
bash: ifconfig: command not found
If sudo is ...
0
votes
2
answers
111
views
Linux permissions for a user not logged in sudoers
There is a server to which I have access (login and password). Logging in as this user on this server it is found that my user is not logged into sudoers. No additional information is available, I ...
0
votes
1
answer
246
views
Why does ASH (shell) not find my commands executed through "sudo"?
To use a command with the "echo into a file" redirection operator >> through sudo... command, I
have written that to redirect through standard input to the sudo process, executed as ...
0
votes
0
answers
40
views
plymouth + xterm + sudo: not work...why?
i create file sh, i click file sh will start to executive. but Xterm not work to run plymouthd... instead kdesu is worked to run plymouthd..but i want to use xterm.. maybe i missing something ...
0
votes
1
answer
75
views
How to Load Personal .bash_rc for SU User via Direct SSH command
Problem
Multiple engineers are using same machine with same loginuser and history gets loaded with others' people commands.
Update: People login via private ssh keys (pub added/removed via trustedhosr)...
0
votes
1
answer
242
views
sudo segmentation fault
In a remote system to which I don't have console access, which I'm connecting through ssh, I broke the sudo installation and now I'm not able to use it at all, and I'm not able to restart as a root. ...
3
votes
1
answer
483
views
sudo results in a new session with a new controlling PTY
On Linux Ubuntu when at terminal I run sudo su or sudo su - the system creates a new session with a new controlling pts, namely
ubuntu@ubuntu:~$ lsb_release -a
No LSB modules are available.
...
2
votes
2
answers
12k
views
How can I find out what my sudo password is on SteamOS?
I'm trying to install an app on SteamOS and it's through the Terminal. When I run the command, I need to enter my sudo password as can be seen below:
The thing is, I’ve never set a sudo password as ...
0
votes
3
answers
2k
views
Starting Nekoray with sudo
I need the GUI proxy manager Nekoray to always start in sudo mode, so that I don’t need to enter the sudo password multiple times when using the program.
(I know this can be done in the terminal, but ...
1
vote
4
answers
1k
views
Get a "full" shell for another user that allows using podman/systemd
I log in wish SSH as one user "Ubuntu" on a server. I however want to manage run some systemd services as another user "ABC".
If I try to sudo -u abc bash as user ABC then every ...
-4
votes
1
answer
176
views
New manjaro install, but wrong password even during reset
I just installed Manjaro, I have used other distros like Ubuntu and Mint before.
After installing it I wanted to switch to root user, so I ran sudo su, went to give my password and it keeps saying it'...
0
votes
1
answer
111
views
Uninstalled package but command remained usable as user (command not found with sudo)
I recently installed silversearcher-ag with sudo and uninstalled it as it required sudo to run the command every single time.
The command I used to install and uninstall this package respectively:
# ...
0
votes
1
answer
254
views
How to give the user account proper rights to premission for /run/seatd.sock?
I'm going to start weston in a user service. Starting weston in a super user service is no problem.
But when I'm starting weston by the regular user, the weston won't start due to this file
Could not ...
0
votes
0
answers
41
views
I have only one user is my linux pc. I deleted myself from sudo user. How to add myself back? [duplicate]
I entered command "sudo deluser myusername sudo", just out of curiosity. I was the only root user and this deleted myself from root user.
Now I can't add back myself because I deleted my ...
0
votes
1
answer
302
views
sudoers nopasswd faulty on debian 12? [closed]
I have troubles with setting up a python script that should run as root, but without asking for password.
It is not the first time that I do it, but this time it fails on Debian 12
What I have already ...