Questions tagged [sudo]

sudo - Execute a command with superuser privileges.

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

How to revoke sudo rights by adding some line to /etc/sudoers?

When we add at the end of /etc/sudoers the following line: username ALL=(ALL:ALL) ALL then user username can use sudo by providing their password. Is it possible to add a line to this file to ...
1
vote
1answer
72 views

How to run a previous command (that uses an alias) with sudo, both in command line and with an alias

(Note: This is not a duplicate question.) On the command line, you can simply use sudo !! to run the previous command with sudo. However, how would this be done if the previous command uses an alias? ...
0
votes
1answer
23 views

Running command in variable under sudo

I am trying to write a script which runs a command as a different user, but under the environment set-up by my own .bashrc. I would like the script to work for our entire team. Here is my attempt to ...
0
votes
1answer
34 views

Having sudo and non-sudo parts in an alias - why does it not work with >>?

I was trying to use an alias which should run two commands, where the first is fine to be run with normal user privileges and the second one needs sudo privileges. alias hosts-get="scp user@host.com:...
1
vote
1answer
39 views

SUDO not found when calling inside a function in BASH script

I am trying to create a function in Bash that creates a directory, then sets the ownership, like this: create_dir() { local PATH=$1 local OWNER=$2 # create log directory echo -e "\n* Creating ...
1
vote
3answers
39 views

Can I configure sudo to print the command to be run?

Before giving authorization to run a command with elevated privileges, I would like to check what command sudo understood - be it because I'm running a script that calls sudo, or because I'm using ...
0
votes
1answer
55 views

How to get the command line history of another user?

I currently have a server set up to save Bash history for every user immediately in their respective home folders and I want to create a script that runs on a set interval that switches the current ...
1
vote
1answer
79 views

Can a process send keystrokes or read text to/from a tty that is running su/sudo?

I need some information regarding the possible attack vector on *nix platforms of running su/sudo. Can an malicious process wait for the user to run su or sudo and then exploit that root access ...
0
votes
2answers
49 views

Sudo does not persist on Debian 10

Sudo in Debian 10 is driving me mad. I have a clean, vanilla install of Debian 10. During installation, I've set a root password as well as created a normal user, let's name him "tom". Logged in as ...
1
vote
0answers
338 views

preventing Buffer overflow when pwfeedback is set in the sudoers file

I am using Linux Mint 19.3. For a few days, there is an explanation that the sudoers file has buffer overflow if the sudo version is between 1.7.1 to 1.8.25p1. And there is a command to see if you ...
0
votes
1answer
40 views

How to enable wheel group in solaris 11.3

I want to add user in wheel group but can not find wheel group in /etc/group file. Also i uncomment the line "%wheel" in sudoers file as: root@solaris:~# grep wheel /etc/sudoers ## Uncomment to ...
1
vote
1answer
18 views

User Creation From Web Server

I'm creating a web app which will allow me to setup shared hosting environments. Everything has to be done programmatically and i'm questioning whether i'm approaching things in a completely insecure ...
1
vote
1answer
74 views

A dot in the linux username causes: “Username is not in the sudoers file. This incident will be reported.”

I have a correctly working Debian server. All existing users who have been granted sudo rights can utilize sudo without any problems. However, a new user with a username that has a dot in it sees "...
0
votes
0answers
37 views

SUDO permissions not working not sure where my problem is

I am trying to give our Service account the ability to restart nginx. here is what I have Host_Alias WEBSVR=int-a3web-01w User_Alias APPUSER=appmin Cmnd_Alias NGINX=/etc/init.d/nginx ...
0
votes
1answer
22 views

Can't source .bashrc from .bash_profile when using `sudo su - username -c`

I have the following in my .bash_profile: echo bash_profile if [ -f $HOME/.bashrc ]; then echo Sourcing bashrc source $HOME/.bashrc echo Sourced bashrc fi My .bashrc file is quite long, ...
0
votes
0answers
37 views

Permissions - Allow a user to reboot and shutdown via the GUI without root password

I have already edited /etc/sudoers as described in this topic: Poweroff or Reboot as normal User ...to allow one specific user to reboot/shutdown via terminal without needing root password, but the ...
0
votes
0answers
24 views

Visudo changes are not effective

My original sudoers file: sudo cat /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly ...
0
votes
0answers
68 views

/dev/ Permission denied

I use Ubuntu 18.04 When I install some programs (for example chromium) I get error /dev/fd/62: no such file or directory sudo does not help. I work on root. When I do 'ls /dev' I get error '...
0
votes
1answer
38 views

Truncated sudoers file, no user can edit it now

So, somehow one of the guys on my team messed up the sudoers file on a couple of VMs (all Ubuntu 18.04). The files were truncated and the only line in them is: nagios ALL=(ALL) NOPASSWD= ALL Which,...
0
votes
0answers
31 views

sudo from standard in on interactive command

I'm trying to run the command cat ./password | sudo -Skp '' yum install git and it goes through the motion and finally gets to the last line where it returns Is this ok [y/N]: Operation aborted. ...
2
votes
1answer
71 views

Difference between connecting shell commands

My tab completion (BASH in debian) shows me different numbers for combining two commands subsequently. It's somehow common sense that I can execute more commands the more privileges I have, e. g. with ...
0
votes
2answers
34 views

Delete file using sudo along with password in the same command

I am using the below command to delete the file: $ echo <Password> | sudo -S -u <User> rm -f <Filename> rm: cannot remove ‘<Filename>’: Permission denied Please let me know ...
1
vote
0answers
36 views

Change ptrace_scope temporarily for a specific user

ptrace_scope is a sysctl value (/proc/sys/kernel/yama/ptrace_scope) that prevents the use of ptrace on non-child processes when set to 1. This is generally considered good security practice. ...
0
votes
3answers
64 views

Some commands appear to be missing unless I use sudo

I am running Debian 10 (upgraded from 9) and I recently noticed that quite a few commands appear to be missing from the system unless they are run with sudo - bash says that they are not found. $ ...
0
votes
0answers
43 views

Is there a way to give a user access to a file without adding it to sudoers?

My monitoring system runs with lowered permissions but I want it to run a command that needs access a particular file in a folder that the monitoring system is not allowed to enter. The usual ...
0
votes
1answer
51 views

Start a su command in a Vagrant

I have a Vagrant machine, but I cannot change the vagrant configuration. I want to access to the vagrant machine, switch to superuser and then launch some commands. How can I do this in one shot or ...
0
votes
0answers
33 views

Running commands with www-data privileges in scripts, crontab and systemd

I've already read "Allow www-data to perform specific commands" article. But, crontab and systemd invokes scripts using root privilege. # my-service.service [Unit] Description=My Service [Service] ...
1
vote
0answers
65 views

sudo: unable to initialize PAM: No such file or directory after editing pam.d

I was playing around with the pam.d file in nano and for some reason along the way I lost root access. Whenever I try to use the sudo command, I get an error like this: [redacted]@[redacted] ~ % sudo ...
0
votes
0answers
25 views

How to make sudo ask for root password for specific commands

I want the user to input root password every time specific commands are run, but for other commands, their own password should be sufficient. Is there a way to enforce such behavior on sudo? E.g., ...
1
vote
0answers
32 views

How to make sudo ask for password each time specific commands are run?

I run ubuntu 16.04 / 18.04 I want to make sure that the users do not accidentally poweroff or reboot remote machines, yet I need to give them the ability to poweroff/reboot after their password is ...
0
votes
2answers
54 views

Can a program get root access if it gets the password?

If there's only 1 user on a system with sudo permission, can another program that ran by the user get root permission without the user knowing it if it has the sudo password?
0
votes
2answers
175 views

Why cannot I become root via `su`?

Why doesn't su work but sudo -i does? When I want to become root via su, the system doesn't accept my password, but via sudo -i it works. su: Authentication failure
1
vote
1answer
30 views

How can an owner / ACL change with su / sudo be refused because of missing privileges?

I've got a file owned by root, which must get write access for normal users (particularly user pi): pi@autoradio:/import/valen/autoradio $ ls -al autoradio.db -rw-r--r-- 1 root root 2887050 Nov 12 ...
0
votes
1answer
115 views

Centos8, run gtk program under sudo privileges: cannot open display: :0

I'm currently struggling when trying to run bleachbit under root privileges on CentOS 8. Using my non-sudo user, there is no problem. When i try to run it as sudo, i get the following error: (...
0
votes
2answers
52 views

You called the script without passing the environment variables, please run as sudo with -E switch

I feel like this is a really dumb question but I have tried everything I could. I am trying to install a program called avr4l but when I try to run sudo ./install.sh, I get this message: You called ...
-3
votes
2answers
62 views

Why does transfer files to another computer by `sudo rsync` require the destination computer's root's password? [duplicate]

I am trying to transfer a directory to another computer $ rsync -a --delete --stats -h wget 'olive:/tmp' Number of files: 5 (reg: 4, dir: 1) Number of created files: 5 (reg: 4, dir: 1) Number of ...
0
votes
0answers
11 views

Force sudo to the environment of the target user? [duplicate]

I have: $ sudo grep env_ /etc/sudoers Defaults env_reset So I would expect that sudo will reset to the environment of the target user, but it doesn't: $ echo $HOME /home/alice $ sudo bash -c 'echo $...
0
votes
2answers
74 views

Restore default groups for a Linux Mint user

Due to a typo a Linux Mint account was assinged to dialout group only. Without the sudo group and the root password I'm not able to restore the funtionality of the account. Is there a way to either: ...
0
votes
0answers
16 views

Why does sudo show up as a root process? [duplicate]

Why does sudo show up as a root process? alice@frob:~$ sudo -u bob ps -Fe | grep bob root 1504 1500 0 2571 4044 3 20:01 pts/0 00:00:00 sudo -u bob ps -Fe alice 1505 1500 0 1523 ...
0
votes
1answer
22 views

Is it possible to begin a sudo interactive session and also provide an initial command?

A lot of my workflow involves using a sudo interactive session (sudo -i) as a service user that is able to run certain things that my personal username can't. When I do this, I like to preserve my PS1 ...
0
votes
1answer
28 views

updating firefox on debian

About a month ago I installed Firefox on Debian. I did that, because I wanted a better functionality and Firefox ESR in Debian repo was outdated. I followed tutorial from Debian wiki (section From ...
0
votes
1answer
27 views

Adding line to sudoers.d with tee not working

I need to make a user able to reload php-fpm. When i run below code to append below line via tee from the root user nothing happens except i enter insert mode (lines with > ) that i can only close ...
0
votes
2answers
81 views

Can I run a terminal command from the terminal, and close the terminal (leaving the program running)?

I found this question: How can I run a command which will survive terminal close?, which addresses exactly what I want to do. And I've been using it for a few applications. But my problem is that I ...
1
vote
1answer
57 views

/etc/sudoers shows no privileges, yet `sudo --list` reports ALL privileges

tl;dr /etc/sudoers and groups implies no sudo privileges. Yet sudo --list reports ALL sudo privileges. Why the difference? Background On an Ubuntu 18 desktop, file /etc/sudoers has Defaults !...
3
votes
1answer
190 views

Why do I get a warning for the sudoers.d when doing an audit with Lynis?

I stumbled upon Lynis - a security auditing tool for linux - and ran it on my Raspberry Pi to see if I could harden it a bit more. I got one warning in the Authentication group that confuses me. - ...
0
votes
1answer
38 views

How can I run commands in a bash script prefixed with sudo, but based on a flag?

My use case is that docker on macOS does not require sudo or root access since it uses a protected security model with some HyperVisor system (details off-topic here), while on Linux based systems ...
0
votes
0answers
28 views

Script to set sudo timeout

I would like to use a script to change the sudo timeout of a machine in an automated fashion. Everything I've found online related to changing the sudo timeout is in regards to visudo and manually ...
0
votes
1answer
73 views

/dev/console behavior that makes no sense to me

[Context: After I read Linux: Difference between /dev/console , /dev/tty and /dev/tty0, I invented a few tests to check my understanding. As a result, I learned that my understanding of /dev/console ...
0
votes
1answer
49 views

single user, once with once without sudo

I have added a new user on my ubuntu machine with the following command: sudo adduser test and then granted him sudo with: sudo usermod -aG sudo test So far everything seems pretty standard. The ...
1
vote
4answers
98 views

How do I make myself an admin or get root privileges so I don't have to keep typing the root password?

I have to use sudo a lot, and it gets exhausting typing the password when I've already entered it plenty of times. How do I make it so that once I've entered it once, it won't ask me again? I'm on ...

1 2 3 4 5 37