Skip to main content

Questions tagged [sudo]

sudo - Execute a command with superuser privileges.

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 views

macos/bash: read "hangs" when executing script second time as another user with stdout redirected before

Hello! My second file descriptors question. Context: Still new at this, I certainly don't get file descriptors. Magic. Unpredictable magic at that, that sometimes works. (joke, but you probably get my ...
Marcus Widerberg's user avatar
0 votes
0 answers
19 views

distrobox export binary with sudo access for rootless container

Can sudo be used for an exported distrobox app/binary in the host where it's container is rootless? Example: I need to edit files in the root partition and admin permissions are required to access ...
Peter Cox's user avatar
0 votes
1 answer
16 views

An ALTER USER postgres PASSWORD 'postgres' fails when provisioning vagrant with Postgresql

I'm provisioning a vagrant box with Postgresql. It looks going well, but at the end, it cannot run an ALTER USER postgres PASSWORD 'postgres'; for a Permission denied. Here's what I'm doing, and what ...
Marc Le Bihan's user avatar
0 votes
0 answers
26 views

Why do I have to sudo for libcamera-still? (Bookworm - PI5)

I am using a raspberry Pi5 with Debian Bookworm 24-3-15. I ran a full upgrade on the system. I installed a camera and got it to work (dtoverlay=imx219). If I am using the camera with libcamera-hello, ...
Heiko Hatzfeld's user avatar
1 vote
1 answer
59 views

Why does augenrules refuse to run even when sudo is used?

I have Amazon Linux 2023 running in a Docker container and I would like to be able to load some custom audit rules into the kernel and ensure they are persisted when the container restarts. I have ...
word4q's user avatar
  • 13
0 votes
1 answer
37 views

LD_PRELOAD variable from /etc/profile is not saved in the environment when running sudo --preserve-env

Added LD_PRELOAD variable to the end of /etc/profile: export LD_PRELOAD=/tmp/libhooks.so Then I start a new ssh session and there is a LD_PRELOAD variable in it: [admin@Centos8 ~]$ env | grep ...
ibse's user avatar
  • 341
0 votes
1 answer
33 views

How to set-up password-less `updatedb` on Linux Mint (21.3)?

After setting a password-less updatedb, I am presented with an error: $ updatedb /var/lib/plocate/: Permission denied How can I fix it? That is just an example error I got latest. I got more of ...
Vlastimil Burián's user avatar
1 vote
1 answer
84 views

How do I enable hibernate for all users (no sudo)?

I managed to resize my LVM partitions, set up my swapfile, and disable secure boot, so now I can hibernate with sudo systemctl hibernate. However, I want to be able to hibernate from my power menu (...
Hari's user avatar
  • 127
0 votes
1 answer
61 views

sudo passwordless in ssh session not working

In RHEL7, I have the same local users on all machines within my cloud tenancy. That local user is configured in sudoers to be able to: run all commands, run sudo commands without password EDIT: ssh ...
Lou Lee's user avatar
1 vote
1 answer
31 views

Confined user (staff_u) can use sudo to transition to unconfined_r even though there is no sudoers entry that permits it

I've created a user that is mapped to the staff_u SELinux user: # semanage login -l Login Name SELinux User MLS/MCS Range Service __default__ unconfined_u ...
Sam Morris's user avatar
  • 1,050
12 votes
2 answers
4k views

Check if current user can run sudo without requiring a password

I want to check if the current user running a BASH shell script has access to passwordless sudo or not. If they don't, I'd rather have the script exit rather than prompting them for a password.
Jay Taylor's user avatar
0 votes
0 answers
59 views

keep sudo effective without password after update sudo package itself

I want to write an automation script in Bash that requires frequent use of the sudo command. To avoid entering my password repeatedly after the sudo timeout, I've tried the following: #!/bin/bash sudo ...
anonymous's user avatar
  • 187
0 votes
0 answers
43 views

Why doesn't "sudo -i -u user bash -c string" run as expected?

On my CentOS 7 machine, there are 5 folders in /home/nanxiao/log/: $ ll /home/nanxiao/log/ total 0 drwxr-xr-x. 2 nanxiao nanxiao 100 Feb 28 15:56 facebook drwxr-xr-x. 2 nanxiao nanxiao 102 Feb 28 15:...
Nan Xiao's user avatar
  • 1,427
0 votes
2 answers
113 views

Lost sudo. Beyond salvation?

I made a mistake and gave a container Homepage access to the docker.sock and briefly after I discovered that sudo is no more. sudo sudo: /etc/sudo.conf is owned by uid 1000, should be 0 sudo: /etc/...
Arelius's user avatar
  • 73
4 votes
1 answer
818 views

Detecting sudo use without logs

Is there any way to positively identify that sudo is being used to execute a command other than to identify the logs? I phrase this in the present tense because I would like to make a command fail if ...
Cort Ammon's user avatar
0 votes
0 answers
81 views

What is a difference between an id set-up to use sesu vs. being added to sudoers file?

We are upgrading Confluent version in production, where the id we have to use is set-up with sesu vs. in lower environments, the id that was used to execute Confluent provided ansible playbooks was ...
adbdkb's user avatar
  • 103
0 votes
1 answer
169 views

Trouble Installing Oracle 19c on Oracle Linux 9

I am following a tutorial to install Oracle 19c on Oracle Linux 9. If I run the installer (runInstaller) as a non-root user, I get a permissions denied error. But if I run it with sudo, I get Oracle's ...
Google User's user avatar
2 votes
0 answers
91 views

How to automate Ansible SSH login with Duo MFA for sudo access

The problem: I'm trying to run Ansible on a Mac to remotely configure a linux (ubuntu) server that requires MFA access for sudo usage. My goal is to keep the MFA in place (as required by our security ...
twoLeftFeet's user avatar
0 votes
0 answers
14 views

Shortcuts running privileged commands

Intro: Using ABIs to control fan_speed, fn_lock, or conservation mode can be done with editing files in the (e.g. /sys/bus/platform/.../) directory which is owned by root. For example if i wanted to ...
white-hat-er's user avatar
0 votes
1 answer
31 views

Permission denied when running a mv command as user after entering into sudoers file

I have a user which needs to move a file to a dated folder. I have an entry into the sudoers file as follows: backupuser ALL=(ALL) NOPASSWD: /usr/bin/mv /var/lib/pgsql/base_backup/*.tar.gz /var/lib/...
Dale's user avatar
  • 3
0 votes
1 answer
59 views

Running sudo, changing dir, staying in sudo, staying in dir after the script finished

I often find myself typing the following commands: sudo -i cd workdir I would like to create a script and name it a single letter. e.g. a so that when I run a the effect is identical to typing the ...
Andrew Savinykh's user avatar
0 votes
2 answers
93 views

Set different permissions for the user and for the java application

I am writing a graphical java (javaFX) application which is a kind of shell over the operating system. I am currently using Java 8 (JDK corretto 8.402), Debian 12 and Xfce. The problem is that my Java ...
Pablo Casil's user avatar
0 votes
1 answer
86 views

Running commands using sudo from within a program

I have a c++ qt program (lets call it test_program to make it easier to refer) which runs sudo lsblk using popen and prints the output. When I run the test_program from within the qt application (the ...
yash's user avatar
  • 137
0 votes
1 answer
50 views

how to configure sudo to allow certain parameter

In particular I want to allow the following command without password: sudo cfgutil --ecid "${Device_ECID}" install-application "${in_File_Name}" With Device_ECID and in_File_Name ...
Martin's user avatar
  • 113
0 votes
1 answer
268 views

Trouble with setting up sudoers file in Debian 12

I keep getting "user is not in the sudoers file" even after I add myself to the sudo group. How can I fix this?
ZGuardian's user avatar
0 votes
1 answer
43 views

Operation referenced in sudoers still fails on kill command

I what to be able to restart ConnMan from within Node-RED. That service runs with its own user nodered. When I SSH into the device as the nodered user and type nodered@pi:~$ sudo /etc/init.d/connman ...
Norbert's user avatar
  • 121
0 votes
1 answer
76 views

How to programmatically determine whether superuser elevation is necessary to invoke code?

When providing code to another, it appears to be good practice to remove all elevation-specific code — that is, provide apt update rather than sudo apt update (or su -c 'apt update'). However, this ...
RokeJulianLockhart's user avatar
1 vote
0 answers
68 views

How can I allow only one user to run a specific command?

I want to block all users on a CentOS system from running a specific command and only allow one, specific user to run it. For example, only the test user can run svnadmin create test1. Other users ...
Chirag Darji's user avatar
0 votes
0 answers
40 views

How to use "sudo -S" commnd in C++ to bypass terminal for password? [duplicate]

I need to run the following command as root without going thru any "sudo" on Linux terminal. . ( Please refrain from "security " comments...) " hcitool cc address " ...
anne's user avatar
  • 45
0 votes
1 answer
56 views

How to add custom (ex. golang) path to sudo?

I am trying to build go project via make. Everything is ok until it goes to deploy in production. The deploying user is not the owner so I have to use sudo. But with sudo system doesnt see go. To ...
Alexander Gorg's user avatar
0 votes
2 answers
66 views

How to check permissions of a non sudoers user with full root access?

doas is a sudo-like command recently packaged in Debian 12, Ubuntu Jammy (universe) and some other Linux distros. A non sudoers user (doasuser) can be added to /etc/doas.conf to be granted root access....
GAD3R's user avatar
  • 67.5k
0 votes
1 answer
179 views

sudoers NOPASSWD tag doesn't seem to work

I'm working on adjusting a script I found here for my own purposes. In essence, the script checks some conditions, and then runs one of two commands using sudo. The command executes as the user cas. ...
Cas's user avatar
  • 103
0 votes
2 answers
115 views

Why using grep for some netstat commands require sudo priv?

System: Ubuntu 20.04.06 net-tools 2.10-alpha grep (GNU grep) 3.4 If I run netstat without sudo I see port information and no process information. This is expected as process information requires ...
Dave's user avatar
  • 621
7 votes
1 answer
499 views

Why does `less` show "This account is not available" when run on a file from a root login shell?

This is not really a problem, just a peculiarity that I'd like to understand. If I get a root shell with sudo bash -l and then run less somefilename I get less only showing: This account is currently ...
Wildcard's user avatar
  • 36.8k
0 votes
0 answers
57 views

How to grant setuid permission to sudo

So, I'm building my own Linux distribution and I've set up quite a lot, including sudo. Working from a shroot environment, sudo works well, the problem is when i actually boot into my distro. ...
Juancarlos Kai Shiro's user avatar
1 vote
0 answers
72 views

How to run this particular command when an user login?

Every time i login i have to run this 2 commands: To be able to make caps2esc program work. But i want to automate this process cd ~/Apps/caps2esc sudo bash -c 'nice -n -20 ./caps2esc >caps2esc.log ...
lapdoggo's user avatar
1 vote
1 answer
119 views

Mounting a USB drive on a synology system: "operation permitted for root only" although sudo was used

I want to mount a USB drive on my NAS synology Following those tutorials: https://askubuntu.com/questions/37767/how-to-access-a-usb-flash-drive-from-the-terminal https://linuxconfig.org/howto-mount-...
ecjb's user avatar
  • 445
0 votes
2 answers
116 views

Crontab doesn't open for user

When I am trying to open crontab I see the next output: ubuntu@macaroon:~$ crontab -l crontabs/ubuntu/: fopen: Permission denied When I add sudo it opens fine however, if the jobs don't work there: ...
catch23's user avatar
  • 221
0 votes
1 answer
55 views

Executing a shell script with sudo / no password

I got this line in sudoers: Cmnd_Alias NVIDIA = /sbin/sh -c 'echo ON > /proc/acpi/bbswitch; modprobe nvidia; modprobe nvidia_drm modeset=1' user ALL=(ALL) ALL, NOPASSWD: /sbin/systemctl suspend,...
jdevelop's user avatar
  • 135
0 votes
1 answer
105 views

Is "pam_unix(cron:session): session opened" misformulated? [duplicate]

$ journalctl -g sudo -S today Jan 21 00:02:02 limbo sudo[3898480]: pam_unix(sudo:session): session opened for user root(uid=0) by seca(uid=1001) Jan 21 00:02:02 limbo sudo[3898480]: pam_unix(sudo:...
sigil's user avatar
  • 165
2 votes
1 answer
75 views

Syntax error in sudoers file

I wanted to allow my ordinary user to run /usr/bin/brightnessctl to turn on/off the keyboard backlight on my laptop, so I did visudo -f /etc/sudoers.d/grove (grove is my username, but all that ...
Henrik supports the community's user avatar
6 votes
3 answers
2k views

linux sudo list permitted commands [duplicate]

Given that /etc/sudoers and /etc/sudoers.d/ are not readable by regular users, is there a way that I, as a normal user, can find out what sudo permissions I have?
mah454's user avatar
  • 308
8 votes
1 answer
897 views

sudo persistent across ssh logins

When I have two separate terminals logged in via SSH to my server, I noticed then when one of the terminals enters password for sudo, the other terminal has passwordless sudo access. This seems ...
Barry's user avatar
  • 83
0 votes
1 answer
48 views

why sudo delays 5s to 10s if WIFI is enabled? and how to fix it?

run this in terminal with internet off: while true;do sudo -n uptime 2>/dev/null;echo "`date`($((i++)))";sleep 0.1;done now turn internet on (WIFI here). The log will happen now every 5s ...
Aquarius Power's user avatar
0 votes
1 answer
489 views

Starting QEMU as another user

I'm currently trying to intercept/block specific requests from the guest in QEMU. According to this question, it seems that the easiest way to do so is to run QEMU as a different user, so that I can ...
Olmarq's user avatar
  • 3
0 votes
1 answer
482 views

How to connect postgresql database without using sudo

I need to create a postgres database on a linux server. However, I don't have admin privileges and cannot use sudo. How to install postgres and create a database without using sudo. I looked at ...
heyula's user avatar
  • 21
2 votes
0 answers
221 views

Sudoers Permissions - User in Multiple Groups

I want to learn to rules pertaining to the effective permissions assigned to a certain user. I've come across this paragraph in Ubuntu's sudoers man page and also in numerous posts here: The sudoers ...
G.Bar's user avatar
  • 71
2 votes
2 answers
685 views

After an update (a kernel bug it seems) Debian 12 hangs when hitting sudo: Unable to install the new kernel with bug fixed

After an update/ upgrade on Debian 12 (weekly update), there is NO WiFi, files are not opening, unable to shutdown or sleep, and freezes when using sudo. The bug is fixed with a new release of kernel. ...
A. John's user avatar
  • 43
4 votes
3 answers
988 views

Can I install programs in linux from any directory?

I am using the latest Linux Mint 21.2. Can I install programs from any directory? For example, if I want to install vim, can I write sudo apt install vim in any directory and linux installs it ...
Programmer's user avatar
0 votes
0 answers
78 views

sudo -i is behaving differently than sudo su -

If I as a non-root user (but in the sudoers file) do sudo -i, I get root privileges: laptop:~$ sudo -i [sudo] password for bjmgeek: laptop:~$ whoami root laptop:~$ id uid=0(root) gid=0(root) groups=0(...
Brian Minton's user avatar

1
2 3 4 5
50