Questions tagged [sudo]
sudo is a tool which allows users to run commands as another user (usually the root user)
149
questions with no upvoted or accepted answers
6
votes
2
answers
30k
views
Unable to restart a systemctl service remotely as a non root user
I have a systemd.socket named gunicorn.socket which I would like to restart after updating some code on a remote server.
I've followed the steps detailed in Allowing a non-root user to restart a ...
5
votes
2
answers
2k
views
Is there a way to allow command in sudo based on the current working directory?
I want sudo to allow me to run a command when my current working directory is, for example, /tmp. Example usage is removing files from /tmp directory, so I am in /tmp ($PWD of shell == /tmp), then I ...
4
votes
0
answers
166
views
what is the risk of allowing the sudo option closefrom_override?
I have an awk script that uses stdout to write to a file and /dev/fd/3 to write a status message about what happened during the run.
When I invoke awk with sudo, it fails because sudo closes all the ...
4
votes
1
answer
2k
views
Docker user namespacing and sudo
I am trying to get a Docker container working with using the user namespacing feature and sudo. If I create the container with the -u flag set to a random UID, then sudo doesn't work, and you get ...
3
votes
0
answers
929
views
File in sudoers.d/ directory became corrupt, cannot delete it? pkexec not working (Azure VM)
So I've got an Azure VM where I wanted to copy a file into an /etc/sudoers.d/ folder. Obviously I've tested the file before copying it, however something weird must have happened when transferring it ...
3
votes
2
answers
4k
views
can't login as root on a remote Redhat Server
I am currently working on a remote RedHat server(RHEL version 6.7 x86_64).
I can login as a user by using userID and password which is provided by
the server administrator.
But when I try to login as ...
2
votes
1
answer
452
views
How to permit the chown use to a regular user, but only on its home directory?
I'm trying to allow regular user A to execute chown command to a list of user B,C,D having as object any files located into its home directory.
In other words, I would try to limit the chown "root ...
2
votes
0
answers
3k
views
PAM: password authentication failed for remote user
I am executing a command from server1 which would do a remote ssh to server2 and execute certain commands as olcne user. I am seeing some exception in /var/log/secure file wrt to pam. Can someone ...
2
votes
3
answers
366
views
Looping transfer SSH keys while opening SSH access of my VM
Yesterday, I was able to connect to my VM without any problem. Today, when I wanted to connect, it just loops over "Transferring SSH keys to VM". When I go in the console, it loops the same thing.
[ ...
2
votes
0
answers
3k
views
Enable Windows Active Directory Groups on Sudoers File
We've recently started enabling access to our linux machines using Windows Active Directory users. The chosen method was kerberos+samba+sssd and it's working fine.
Our next step is to allow certain ...
2
votes
0
answers
155
views
sudo log entries don't show username on Debian Stretch
For some reason, the username of the user calling a command with sudo is not shown in the system log:
$ journalctl -ef
sudo[30160]: pam_unix(sudo:session): session opened for user root by (uid=0)
...
2
votes
0
answers
426
views
ssh -t -t sudo displays back my password
My problem is about executing sudo over SSH. I have tried various things, but non works.
Here is my script:
ssh my-host /bin/bash << EOF
# some commands...
sudo -u my-user -s -- << EOFF
...
2
votes
0
answers
676
views
For sudo su - to retain SUDO_* environment variables?
We have a number of script (for Openstack operations) which require privileged execution in our environment. For some of the scripts we'd like to refer back to the USERNAME or UID of the person who ...
2
votes
1
answer
385
views
mongodb 2.4.9 is crashing on wheezy when running as root
I installed mongodb-10gen v2.4.9 on a debian Wheezy, and I'm having this really weird behavior:
if I run it as root I can't get it starts:
root@xx:~# /etc/init.d/mongodb stop
[ ok ] Stopping database:...
2
votes
2
answers
202
views
Root user is not able to access
I had a ubuntu user which has root level privileges but I haven't created password for it, there are other user also on the machine but none of them have sudo permissions, unfortunately permissions on ...
2
votes
0
answers
1k
views
Nginx doesn't seem to stop correctly
I'm using the following script to start/stop nginx:
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# ...
1
vote
0
answers
1k
views
'user ... is not allowed to execute .... as root on ... ' - even with SUDO privileges but not sure why?
I am in the processing of installing singularity using the terminal on my Linux Mint computer (Ubuntu).
I have the following command:
sudo apt-get update
The computer then asks me to enter my ...
1
vote
1
answer
2k
views
Ubuntu 22 server slow to login and execute sudo
On several servers running Ubuntu-server 22 we have the problems that some commands take a very long time to execute. These commands include ssh login as well as sudo commands. Everything not evolving ...
1
vote
0
answers
93
views
Can't find font as regular user
As a root, I can run gvim with my font selected as 'Ubuntu mono 14' and have everything work correctly. But as a regular user using the exact same config file selecting the exact same font, I get this:...
1
vote
0
answers
414
views
sudo hangs after some time
sudo hangs in my Archlinux (running under Hyper-V) after some time (usually a day).
Since this hangs my system, I have kept a root window open to do strace whenever this happens. strace sudo ls shows ...
1
vote
0
answers
203
views
selinux - why can't stuff_u with sysadm_r run postsuper?
I am trying to understand how selinux confined users really work, but there are a few behaviours that I still can not understand.
According to redhat
SELinux User Capabilities
stuff_u users should be ...
1
vote
1
answer
304
views
Not able to sudo - ubuntu 20.04
A classical error
By mistake we did sudo chown -R ubuntu:www-data / on a ubuntu 20.04 AWS EC2 server. While there are many posts which indicates that I cannot salvage the machine and have to ...
1
vote
0
answers
3k
views
How does the sudoers option 'pam_session' correspond to PAM's 'session' type?
On a CentOS 7 system, I want to prevent lines such as
May 20 08:55:05 c090 sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
May 20 08:55:05 c090 sudo: pam_unix(sudo:session): ...
1
vote
0
answers
165
views
Cannot perform command as a different User - even from root user
I have pm2 node modules installed in a user called otheruser. I need to run the program from root user.
If I normally logged to otheruser and perform any action its working fine.
otheruser@bubble-...
1
vote
0
answers
217
views
Sudo needed a second time when rsync files with ssh key
I use a command to transfer files with rsync and a ssh key:
sudo rsync -P -e 'ssh -i <absolute path to keyfile>' <file> user@<server>
I need the first sudo because the file I'm ...
1
vote
0
answers
139
views
Difference between 'sudo gem install something' and 'gem install something'
In this case I'm using gem as an example, but I think it can be extended to any other program.
I use a Mac and I installed rails using command gem install rails from directory /Users/myusername/...
1
vote
0
answers
33
views
Problems with accessing external content as sudo/root
System environment: VM running under Debian 9, firewall is iptables. UFW, etc not installed.
I run into problems when spinning up a kubernetes cluster by executing sudo kubeadm init. The call causes a ...
1
vote
1
answer
89
views
kernel tunables for non privileged user
How can i permit non privileged user to set kernel tunables within specific limit. For instance to let user set hugepages up to 40
sysctl -w vm.nr_hugepages=40
1
vote
0
answers
52
views
Why is sudo password entering lost
When I use sudo command and pipe it to another command, e.g.
sudo dnf search foo | grep bar
there is a prompt requiring to enter the password. Following this answer, sudo directly accesses the ...
1
vote
1
answer
1k
views
Disable sudo prompt without disabling the need for sudo password
This is quite tricky I guess, or at least not desired very often.
What I am not after is:
Disabling password with
user ALL=(ALL) NOPASSWD: ALL
Or a similar trick.
I know how to read sudo ...
1
vote
1
answer
2k
views
Disable NOPASSWD sudo access for ubuntu user on an EC2 instance and keep it permanent
After following this forum:
Disable NOPASSWD sudo access for ubuntu user on an EC2 instance
I disabled sudo access for the default ubuntu user by changing the appropriate line in /etc/sudoers.d/90-...
1
vote
0
answers
288
views
Create a screen. Run said screen as a user. Detach
I'm essentially trying to combo Create screen and run command without attaching and another answer that allowed me to run a script as another user. I want to
SSH from Server 1 -> Server 2 and run a ...
1
vote
0
answers
425
views
sudo no more working after change to /etc/hosts
I had to add a DNS alias into /etc/hosts, and I've added it in first position instead of last, replacing the FQDN.
After this (not right after, but at least the next day), sudo was no more usable, ...
1
vote
0
answers
433
views
Need to give a non-privileged user permission to execute apachectl script
I want that a regular user to be able to execute apachectl in the system. And that would be the only thing that they can do outside of it normal permissions. What I did is to add this line at the ...
1
vote
0
answers
72
views
Aliases defined at login don't seem to work with sudo
I'd like to define some global aliases which would be available for everyone on a mult-user linux system (git shortcuts, etc). It seems I have two options avaialable; either place these aliases in (...
1
vote
1
answer
74
views
Specific sudo-shell command takes up to 20 minutes
I'm running multiple LEMP stacks on Google Compute Cloud infrastructure. All VM's are identical to eachother when initiated and I've got this weird issue with one of them. Whenever I run this command, ...
1
vote
0
answers
259
views
Debian 8; Run sudo in a screen session at boot without password prompt?
I want to create a startup/boot script that allows me to run a couple of Screen sessions.
This I have been able to achieve through creating a script on /etc/init.d/bashfilehere
But when I need to run ...
1
vote
0
answers
997
views
How to give PAM authentificated users sudo powers?
I set up PAM linked to an openldap, and I want all the authentificated users to be able to use sudo.
I thought I could create a posix group in the ldap called sudoersgroup, and write a rule in /etc/...
1
vote
0
answers
57
views
LDAP and User root/sudo on local netboot ubuntu/debian machine
I'd like to create a debian/ubuntu pxe netboot image authenticating against ldap but I want give the user the power to install software on his local machine.
In Windows I simply add a local admin ...
1
vote
0
answers
1k
views
Running systemd-tty-ask-password-agent without sudo
We have user home directories that are automatically mounted via autofs through LDAP. Every time a user wants to cd into their home directory, we get an error message as follows: Please enter password ...
1
vote
0
answers
639
views
Fixing a duplicate in sources.list - Not sure what to delete
For a while I've been having this issue but I'm not too sure what to modify in /etc/apt/sources.list.
Here is my sources.list file:
## Note, this file is written by cloud-init on first boot of an ...
1
vote
1
answer
2k
views
How do I allow a normal user to restart a supervisor group without password?
I am trying to allow a user in the group deployer to restart a supervisor group without a password; this is the content of my /etc/sudoers.d/deploy:
%deployer ALL=(ALL:ALL) NOPASSWD:/usr/sbin/service ...
1
vote
1
answer
79
views
Confusing e-mail related to sudo
My system occasionally sends me this email. (My domain has been replaced with [DOMAIN] and my username has been replaced with [USERNAME].)
Subject: *** SECURITY information for [DOMAIN] ***
[DOMAIN]...
1
vote
1
answer
190
views
How can I ensure auditability and least privilege based on AWS users inside an EC2 image?
I'm interning at a company which runs in an AWS environment and is starting to look into locking down user privileges, so I'm looking into ways to secure EC2 instances. Specifically, I want to find a ...
1
vote
1
answer
2k
views
Sensu executing script sudo a password is required
I have a sensu handler that gets triggered on an endpoint Linux box (Centos 6.6. Here is the script I'm using:
#!/bin/bash --login
sudo -n -u deploy bash --login -c "cd /var/www/vhosts/sc/current; ...
1
vote
1
answer
231
views
Centos 6 - Allow sudo composer self-update for user without password
I'm trying to allow my wheel group user to run sudo composer self-update without a prompt for a password for my deploy script.
I have added the bottom line below to my /etc/sudoers file:
## Allows ...
1
vote
0
answers
50
views
sudo as another user that contains current user string in username
Let's say there are 100 users in the system:
msmith
bdole
agrant
. . .
Is there a way to write a generic sudoers rule to allow each of these users to execute commands as another user, where the ...
1
vote
1
answer
2k
views
sudo and Kerberos on AWS Linux issues
We have an issue on some of our AWS machines, running Amazon's hacked Fedora/RHEL linux where newer-in-AD users can login with password but cannot autheticate for sudo. Users that were created in AD ...
1
vote
0
answers
28
views
restoring debian user access
I have accidentally set the owner for all files and folders in the /home folder to 'root' (and a lot of other folders also) and now when I ssh into the server as myusername, I get the following error:
...
1
vote
0
answers
207
views
audisp-remote signal USR1 works as root, not with sudo
So I have a weird problem that I'm running out of ideas to troubleshoot.
My RedHat machines are using audisp-remote to send syslog messages to a central server. audisp-remote will respond to the ...