Questions tagged [sudo]

sudo - Execute a command with superuser privileges.

Filter by
Sorted by
Tagged with
0 votes
2 answers
63 views

Linux How to find the id of a user who ran some particular command using sudo

In shared environment where multiple users have sudo account, I want to find out underlying user id (not a sudo account) details who has invoked particular script. Thanks. I tried below but it does ...
AshwinD's user avatar
0 votes
1 answer
69 views

Disable password login but keep sudo -v?

I'm on a Raspberry Pi, but I don't think this question is specific to Raspberry Pi OS. I only use an SSH key to log in as user pi. I have a script that calls sudo -v which currently asks for the ...
AndreKR's user avatar
  • 1,040
-1 votes
1 answer
58 views

Can I disable password login but still allow sudo?

While answering comments I realized what I should really be asking, so I asked a new question. I'm on a Raspberry Pi, but I don't think this question is specific to Raspberry Pi OS. I only use an SSH ...
AndreKR's user avatar
  • 1,040
0 votes
2 answers
68 views

Letting a stranger in safely

I have setup a really tiny wireguard server in my home, with my public IP and all. I have used NAT to hopefully protect myself as much as possible, set strong passwords... All these things. A friend ...
Orsu's user avatar
  • 109
0 votes
1 answer
44 views

Can you make Sudo display a message when access is granted?

Sudo already tells the user when access is denied: [jayman@this-machine:~]$ sudo echo hi [sudo] password for jayman: Sorry, try again. [sudo] password for jayman: Sorry, try again. [sudo] password ...
Ginger Jesus's user avatar
0 votes
1 answer
83 views

It says always I'm not in "sudoers" file!

I migrated from Ubuntu-20 to Debian-12, and I can't excute the command sudo with my username my_name within a fresh installed system. So, I added my_name into "sudo" group(usermod -aG sudo ...
Leon's user avatar
  • 141
0 votes
1 answer
19 views

Granting privileges using visudo still prevents user to execute command

Following this solution, I want to grant to the user daemon the execution of /bin/date. Here what I did: find the user that apache2 uses when spawning: # ps | grep httpd 252 root /usr/bin/httpd -...
Mark's user avatar
  • 713
0 votes
1 answer
46 views

Is it possible to grant a specific privilege to a user without sudo?

I'm not going to add sudo in my Buildroot environment for RPi 3 B+ since I just need apache2 to update my system time with date -s TIME. Is there a way to grant this permission without installing and ...
Mark's user avatar
  • 713
0 votes
2 answers
32 views

sudo: get sound playback running as another user

I block all Internet traffic for my kids' Linux accounts using iptables. Sometimes I want to allow them to use one program or another. In such cases I enable them to run that programs as another(...
user1876484's user avatar
0 votes
1 answer
50 views

Why does Flatpak not require a password?

Flatpack is installing software, right? Example: my distro (Ubuntu based) installed Brave and Chrome browser updates today, no password was required. Isn't sudo, or otherwise admin access, required to ...
Paulb's user avatar
  • 245
0 votes
0 answers
18 views

How can I specify a gid range in a sudoers Runas_Alias specification?

How do I allow some_user to run some_command as users with group ids comprised between 2000 and 2999 in a sudoers file ? Is it possible to specify a range of gids instead of a list in a Runas_Spec ? ...
reyjul's user avatar
  • 1
0 votes
0 answers
31 views

Configuring Sudo to use AD/LDAP password

Looking into the feasibility of configuring our VMs (RHEL 8) so users in the wheel group use their LDAP password to authenticate for Sudo What I've done so far is configured sssd for LDAP ...
user3777740's user avatar
-1 votes
0 answers
49 views

Unable to run commands with Sudo

After updating my system from the terminal, running commands with sudo gives the following error: sudo: PAM account management error: Module is unknown sudo: a password is required After rebooting, ...
akoshodi's user avatar
1 vote
0 answers
73 views

I can no longer run sudo commands - password not accepted

I have a server running Ubuntu which has been online for over a year. I connect to the server through SSH using my own user (not root) and using SSH keys (passwordless login). This user is part of the ...
T_M100's user avatar
  • 11
0 votes
0 answers
223 views

PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?

Currently I am trying to use pdfinfo for extracting the content in the pdf files. I have installed poppler-utils in local using !sudo apt-get install -y poppler-utils and it worked, Now I am running ...
ram_98's user avatar
  • 1
0 votes
0 answers
55 views

Run QT gui application via SUDO Wayland

I am running wayland (riverwm) in Void linux, and trying to use rpi-imager. rpi-imager fails to write to device because it requires sudo permissions. I then try to run rpi-imager with sudo but get the ...
Guilty's user avatar
  • 133
0 votes
1 answer
48 views

Run one command as root within script

I have a script that I would like everyone (world) to be able to execute. However, one line in the script requires root privilege to run properly. How can I make this script work for everyone, ...
TSG's user avatar
  • 1,630
0 votes
1 answer
46 views

Reducing repetition in sudoers file

I have a sudoers file, that allows a user to run sudo commands without a password (mostly to manage specific services). I would like to drastically reduce repetition throughout the config: Here's a ...
nooblag's user avatar
  • 107
3 votes
1 answer
103 views

`sudo --preserve-env=MY_VAR` vs `sudo env MY_VAR=$MY_VAR`

I read in man sudo the following: --preserve-env Indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may return an error if the ...
Doron Behar's user avatar
0 votes
0 answers
41 views

Torsocks prevent starting firefox and using sudo

I recently activated torsocks with source torsocks on and then restarted my Fedora 37 machine. After that I wasn't able to execute any commands as sudo anymore with the message /usr/bin/sudo: ...
Jan's user avatar
  • 23
0 votes
0 answers
67 views

Running Application in Specific Network Namespace Without Sudo?

I am trying to run google-chrome with a specific network namespace, but when I do there is no audio. I run the command so that it is running in the network namespace as follows: sudo ip netns exec ...
Mark's user avatar
  • 11
0 votes
0 answers
17 views

Kitty shortcut to escape prompt

Inspired by this answer I have the following mapping in my kitty.conf to escape a stuck command quickly: map ctrl+shift+z send_text normal \x1akill -9 %%\r But for commands which prompt the user such ...
xeruf's user avatar
  • 501
0 votes
0 answers
83 views

Execute a virsh command as another user in interactive setup script

I am using a script to setup some Fedora machines and I can not execute a Virsh (cli tool for Libvirt) command as another user. The output given indicates that the command was successful but it fails ...
MathsJoe's user avatar
0 votes
1 answer
71 views

sudo cannot ls root owned files in /proc

I am on Debian 12 and I am trying to write a script to identify processes with certain inodes (from /proc/net/raw and /proc/net/packet). My original grep command is this (to get only the pid itself): ...
user avatar
1 vote
1 answer
40 views

Sudoers still asks for password while executing the bash script

When I try to execute a bash script which has sudo access set in sudoers file but it still asks for password sudoers_dev file in /etc/sudoers.d/sudoers_dev Cmnd_Alias DEPLOYER = /home/...
Reddy's user avatar
  • 13
0 votes
1 answer
59 views

bash script to backup config file inside git repo reproducing its path

I want backup some config file in a git repo inside my home; earlier I've been using work-tree=/ but i don't like this solution anymore. Now I'm trying to create a script that take a given config file,...
Alexander Beerhoff's user avatar
1 vote
1 answer
71 views

sudo doesn't ask for a password

This is a tricky one. I understand to put NOPASSWD into the sudoers file to allow no passwords. But I'm trying to revert this and came across a server I have that has no trace of NOPASSWD anywhere. ...
Gene's user avatar
  • 23
1 vote
2 answers
108 views

/proc/self/fd/2 can not be accessed under `sudo -u other_user`

I often use tee /proc/self/fd/2 to show something both to stdout and stderr, capture stdout, while still keep all output to stderr. E.g., I have a do.sh: STD_OUT_STR=$(CMD ARGS ... 2>&1 | tee /...
osexp2000's user avatar
  • 462
0 votes
0 answers
31 views

Why root user needs `sudo` to execute some commands [duplicate]

When I switched to root user using su command, I still need to use sudo reboot instead of reboot to reboot the system, otherwise bash returns bash: reboot: command not found Why is that the system ...
Yiyang Yan's user avatar
0 votes
0 answers
34 views

How to properly format the command argument for sudo? [duplicate]

I have a command that is similar to this minimal example: $ sh -c 'echo "1=$1"' _ foo 1=foo $ When I want to run it through sudo, it stops working: $ sudo -i -u user -- sh -c 'echo "1=...
finefoot's user avatar
  • 2,980
1 vote
1 answer
60 views

How to prompt "su" to re-request a password on an incorrect entry?

Default su behaviour : system@sword:/etc/pam.d$ su - test Password: su: Authentication failure <su exits> I need to configure "delay" when someone enters an incorrect password for ...
sword's user avatar
  • 11
0 votes
2 answers
44 views

Run part of command line command with sudo

I execute this time sudo nice -n -20 bash myscript.sh myscript.sh then processes some files as well as create files with the result. Two problems with this: the script is run as root the resulting ...
d-b's user avatar
  • 1,713
0 votes
1 answer
53 views

Problem with permissions - propably after using "sudo chown -R me ./"

I am preety new to Linux. Recently, I used the command "sudo chown -R me ./" to grant myself permission to a certain folder. If it matters at all, I ran this command in the '/var/www' folder....
Robert Juszczyński's user avatar
0 votes
1 answer
134 views

sudo mkdir /srv/www permission denied

I'm setting up a new webserver on Debian. As my previous install had everything located in /srv/www I want to use the same setup to avoid rewriting a bunch of config files. However executing mkdir /...
user avatar
0 votes
1 answer
50 views

How could I use a different HOME directory at login

I'm using a server that is shared with about 7 other people. We each have our own user account, but they don't have permissions to access most of what we need, so they're essentially useless other ...
foxbeard's user avatar
7 votes
2 answers
5k views

Does "sudo" rely on "su" in any way?

I want to prevent the users from using the su command, and so I blocked the command in /etc/sudoers file as below: %group ALL=(ALL:ALL) NOPASSWD:!/bin/su But with this rule in sudoers, they are ...
Karthik's user avatar
  • 155
0 votes
2 answers
101 views

Don't have permissions to create folders or delete files in $HOME

I have lost the permissions to create files/folders in /home/user without using sudo. I have a few snippets below of what I mean. I tried to install nyxt-git from the AUR beforehand and it errored out....
Hercislife's user avatar
3 votes
1 answer
173 views

user has NOPASSWD privileges, sudo still asks for password

I am trying to allow a user sudo access to NOPASSWD but something seems to be overridding the config? First invocation of sudo asks for a password. Here is the output of the users sudo permissions and ...
baudneo's user avatar
  • 31
0 votes
0 answers
59 views

User can't sudo even if mapped to staff_u

I created a new user yv8904_local that i mapped to staff_u in SElinux. I want the user to ssh and be allowed to sudo. I'm able to ssh with the user but i can't sudo, i'm getting this error : > sudo:...
Mooh's user avatar
  • 101
0 votes
2 answers
99 views

using sudo or setuid with script for apache webserver

I have a home webserver I muck around with, mainly for learning and testing. I use Apache2 on Debian Bullseye. One of the things I have been playing around with is running Bash scripts from the ...
Èl Sea's user avatar
  • 43
0 votes
1 answer
3k views

Debian all sudo commands fail with 'user is not in the sudoers file. This incident will be reported.' error [duplicate]

I tried out Linux for the first time. When I installed Bullseye Debian a few hours ago I created a root account and user account. Both of them have a password. However whenever I try to use sudo to ...
ykg39958's user avatar
1 vote
1 answer
342 views

Running the "command" command as root using "sudo"

How to execute the Bash command command using sudo in order to run it as root? Using sudo command fails: $ sudo command ls sudo: command: command not found
user avatar
0 votes
1 answer
110 views

Allow a group to impersonate others using sudo, but don't allow them to become root

We have a user support group and want to allow them to login to non-root users via sudo. %user-support ALL = (ALL) /bin/bash, !/bin/bash *root* We put the above code in /etc/sudoers.d, and the user ...
Dan's user avatar
  • 1
0 votes
1 answer
46 views

I have modified my /etc/sudoers to execute any command with out a password but it didn't work and it still prompted a password request

Question I have modified my /etc/sudoers (by visudo) to allow myself to execute any command with out a password but it didn't work. All of similar questions don't work for me. I still have to input my ...
BreakingLead's user avatar
0 votes
1 answer
1k views

How to install sudo on Alpine 3.17 VM?

I have installed Alpine r3.17 on a VM under KVM. I want to install sudo tool. # su - # apk update ... OKL 4994 distinct packages available # apk add sudo ERROR: unable to select packages: sudo ...
will's user avatar
  • 480
1 vote
1 answer
139 views

sudo says unable to resolve host

I changed my hostname by hostnamectl hostname Newname, then when I run sudo the terminal will stop for one second then prints an error message. sudo: unable to resolve host Newname: Temporary failure ...
gsf673324's user avatar
1 vote
1 answer
74 views

Discover which process is asking for sudo?

I have a fairly long-serving Ubuntu 18.04 LTS desktop computer onto which I have installed a great many apt packages from mainstream and non-mainstream repositories as well as numerous random tarballs ...
rvse2003's user avatar
1 vote
2 answers
287 views

How to sudo to admin user after SFTP connection

I have a requirement to sudo to user 'admin' after connecting to SFTP server with below command. sftp user@hostname sftp> sudo su - admin Invalid command. Is there any other way I can use sudo?
user569136's user avatar
0 votes
1 answer
68 views

Get current user who is using sudo [duplicate]

So, let's say I have a shell script that's supposed to be run as root, but I want to execute commands using runuser as the user who is running sudo. I could do runuser -u tux echo penguin. However, ...
Eduardo Perez's user avatar
0 votes
0 answers
85 views

Running a local script on remote server over ssh with sudo privileges

I have a script script.sh on local machine which I want to execute on remote server with sudo permissions. I am logging in to remote server through SSH and executing the script using the below command ...
Anubhav Rai's user avatar

1
2 3 4 5
49