Questions tagged [sudo]
sudo is a tool which allows users to run commands as another user (usually the root user)
896
questions
0
votes
0
answers
521
views
Tenable su+sudo and selinux
My Not-A-Sysadmin-Boss wants me to explain this but I can't really find an answer? When using TENABLE SC to scan a RHEL7 system the account used to do the scan connects via ssh then uses sudo to ...
0
votes
2
answers
1k
views
sudo: unable to stat /etc/sudoers: No such file or directory
I moved the file /etc/sudoers to /etc/sudoers.bkp
after this I cannot run sudo command and neither can login as root and change the file back
is there any way this can be resolved without reinstalling ...
0
votes
1
answer
1k
views
Wazuh ignore a specifc user from sudo notifications
I'm monitoring my servers using Wazuh 4.1.x. My servers are Ubuntu and CentOS. They are also monitored using Icinga2 and NRPE agent. Wazuh is logging all sudo authentications or commands ran with sudo ...
0
votes
0
answers
268
views
Why is my Samba share only writable by root?
I have set up a Samba share, and it is only writable by root. For example, I can only create a folder on that share with sudo:
~$ mkdir /mnt/SHARE/somedir
mkdir: cannot create directory /mnt/SHARE/...
1
vote
0
answers
199
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
303
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
1
answer
109
views
Reload Apache Using ACME User
I run a web server on Debian 10 (Buster) and Apache 2.4.38. I created a special user acme that runs scripts for renewing TLS certificates.
$ cat /etc/passwd | grep ^acme
acme:x:1002:1002::/var/acme:/...
1
vote
2
answers
1k
views
CENTOS apache ALL=(root) NOPASSWD: /path/to/shell.sh is not working
Trying to do a web interface IPtables management.
Created a file test.php
$output = shell_exec('sudo bash /usr/bin/iptables.sh 2>&1');
echo $output;
Gave /usr/bin/iptables.sh NOPASSWD so I can ...
0
votes
1
answer
707
views
Trying to get sudoers working on openldap/centos7
I was following this tutorial here:
https://kifarunix.com/how-to-configure-sudo-via-openldap-server/
A lot of it made sense, but still new to openldap so some of this is cryptic too. I have the ...
0
votes
2
answers
390
views
Linux: Is it possible to use the ssh key pair instead or in addition to the root privileges?
I'm facing the problem of securing an embedded platform. All ssh hardening have been setup, including 2 factor authentication and login with ssh key pairs.
Now, the root and user passwords are ...
1
vote
1
answer
329
views
Allow my users to remove root-owned directories within their HOME
My users are on Ubuntu running Docker and mounting directories in their sessions. The problem is that any non-existing directory or file mounted with Docker is owned by root.
I would like to allow my ...
0
votes
1
answer
893
views
Update sudoers file in multiple servers with a bash script
I have 50 Linux servers and can login to the servers without root password (I know the password). Now I would like to add 3 lines in sudoers file on each servers. Obviously logging into 50 servers and ...
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): ...
0
votes
1
answer
77
views
how to create a script shell command
Hi evry one can someone help me to get this command with scrit shell ?
root@VPS:/work# cpan
Loading internal logger. Log::Log4perl recommended for better logging
CPAN.pm requires configuration, but ...
-1
votes
1
answer
153
views
Allow user to execute sudo commands without inserting password
I have a Debian-based system (most likely an Ubuntu 18.04 LTS) with a user, say user, that executes an application (as a daemon). The system is not exposed to the Internet with a public IP address.
...
1
vote
1
answer
685
views
Allow a user to restart a service
I am trying to restart a service without being root. Here is the code snippet where the command being used
template {
source = "{{vault_template_dir}}/agent.crt.tpl"
destination = &...
3
votes
1
answer
839
views
gcp container-os with OS login and IAM admin asking for sudo password?
I'm running cos VERSION_ID=85 BUILD_ID=13310.1209.17 and I love the web ssh console. It was bugging me to enable OS Login to speed up authentication so I finally did it.
The user i'm logging in with ...
0
votes
2
answers
42
views
Running newusers util in cron to batch create users does not run [duplicate]
I'm attempting to batch create some users from a file using the newusers util on ubuntu 18.
When running in cron as the root user, nothing happens. When I run the command manually, it works as ...
4
votes
0
answers
164
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
14k
views
Grant a user sudo powers to start/stop/etc a systemd service w/o sudo password
I have one non-root user, and I would like to give them sudo permission to start & stop (etc.) a systemd service file without needing a password.
I tried to just make the following file in /etc/...
0
votes
2
answers
339
views
Want to allow application to mount a drive using rhel 8
I can mount my drive using sudo mount.cifs ......
I can unmount doing sudo umount /mnt/mountpoint
It was prompting me for a password, so I changed the sudoers file to NOPASSWD:ALL and now it does not ...
1
vote
2
answers
2k
views
Restrict a user to only interact with a systemd service via Ansible
I want to have a user that is only able to start/stop/restart/status a service via an Ansible playbook.
The playbook looks like this:
host: my-server
remote_user: my-user
tasks:
- name: "Start ...
0
votes
1
answer
2k
views
How to allow PHP exec to reload NGINX
How can I allow these commands in PHP:
$output = exec('sudo nginx -t 2>&1');
$output2 = exec('sudo /usr/sbin/service nginx reload 2>&1');
I've looked into sudo visudo in the terminal , ...
1
vote
1
answer
974
views
logrotate postrotate seems not being executed
I have this configuration on Ubuntu 20.04:
/home/impulse/nginx/log/*/notice.log /home/impulse/nginx/log/*/access.status_ok.log /home/impulse/nginx/log/*/access.status_erro.log {
daily
nomail
...
0
votes
0
answers
44
views
Google LAMP trying to update sudo
I was trying to update sudo on my LAMP cloud server at Google, but to no avail it seems.
Doing sudo apt update, then sudo apt install --only-upgrade sudo if finds the same sudo as on the system: Get:1 ...
1
vote
1
answer
3k
views
How to protect against sudo vulnerability CVE-2021-3156
I tried to patch the new sudo vulnerability as described in https://access.redhat.com/security/vulnerabilities/RHSB-2021-002
I'm getting the following error.
# stap -g sudoedit-block.stap
Checking &...
0
votes
1
answer
2k
views
zabbix : prob.... with defaults entries ; TTY=unknown ; PWD=/ ; USER=root ;
Zabbix sends me those annoying emails with body:
zabbix : problem with defaults entries ; TTY=unknown ; PWD=/ ; USER=root ;
Now I do not have sssd installed, nor do I have sss word in /etc/nsswitch....
1
vote
0
answers
163
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
1
answer
304
views
How to run wall command as another user in Linux (RHEL8)
How do I send a wall message as root (or any other user) and it not identify the original user?
Looking at the below I would have expected wall to display message from root but it still shows admin1, ...
3
votes
1
answer
12k
views
Ansible "missing sudo password" even with passwordless sudo enabled
I have in my sudoers file
ALL ALL = (ALL) NOPASSWD: ALL
Which allows anyone to use sudo without entering a password. And I confirmed that I can sudo without a password when I ssh into the ...
0
votes
1
answer
376
views
chaining ssh update commands in a script fails
I want to run a single script locally that invokes a 'sudo ./up' on several remote hosts via ssh.
Where ./up is simply:
---- /home/user/up ----
#!/bin/bash
sudo apt update && sudo apt -y ...
0
votes
1
answer
3k
views
Self-Hosted Github runner, how do privileged commands work?
What I'm trying to achieve:
A fully automated deployment for a React App, on any commit to the live branch, by my own defined Github Runner, which is running Ubuntu Server 20.04, with npm 6.14.8
What ...
3
votes
3
answers
1k
views
rsync but keep destination ownership without setting to source ownership
I've got some files which I would like to sync to a linux server. Only problem is it resets the ownership and group to the current user and group.
Unfortunately the options --owner, --group, and --...
1
vote
1
answer
996
views
Is there any way to force sudo to not log actions from a specific user?
All of the servers in my network are running a Zabbix agent for monitoring, and some of the additional items I've added to them require the use of sudo to execute.
Normally this isn't that bad, but ...
0
votes
1
answer
383
views
How can I disable users in "domain admins" group from running sudo?
Hi we have a large company and have some Domain Admins who belong to the
id myadminuser
groups=101010(domain admins),
"domain admins" group.
I was surprised by default that the sudoers %...
0
votes
1
answer
508
views
Audit ALL Sudo users and show the users UID( ) not root's UID (0)
I'm trying to log ALL users activities using su/sudo's but the logs show UID (0) root, I want to see the actual UID of the user and not Root.
I've tried the Auditctl service and I've search for PAM ...
1
vote
0
answers
216
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 ...
3
votes
2
answers
7k
views
awscli v2 needs sudo to run otherwise get permission denied error ubuntu 20.04.01
I've installed the awscli V2 as per the official AWS instructions here:
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
$ unzip awscliv2.zip
$ ...
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/...
0
votes
2
answers
97
views
Does sudo access necessarily compromise network security? (naive newbie)
I work in software development for a large corp with fairly strict IT. I am ignorant of security practices. Developers on Windows machines have local administrator rights, are able to install apps etc,...
0
votes
1
answer
709
views
su - with automatic change directory once su command is done in shell scripting
im not familiar in shell scripting but im trying to achieve at least this script but my problem is once superuser rt is done logging in it brings me to this
[rt@superuser root]$
instead of reading ...
0
votes
3
answers
3k
views
Bash: Checking if can sudo on remote host using sshpass; how 'exposed' is the password?
I am using bash script below to test whether sudo is available on a remote host.
I'm obtaining the password from user input. I understand (to a limited extent) that using passwords inside a script ...
1
vote
1
answer
708
views
How can I permit a user to run some commands with passwordless sudo - without breaking all other commands?
I am on a CIS-hardened RHEL 8 host on an AWS EC2 instance. My goal is to permit my user to run some commands with sudo passwordless (e.g. ls, cat, ...), while other commands (like vi) should stay ...
0
votes
1
answer
271
views
Compute OS Admin Login role doesn't make user sudoer
I have a user with the Compute OS Admin Login role, but when I log in using ssh, this user is not a sudoer. I've tried to restart the instance, but still the same. I've tried with enable_oslogin:TRUE ...
1
vote
1
answer
1k
views
sudo error "Either need terminal or -S option"
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/myapp_FrontUAT
using credential 27a4cc0a-d18c-4a8f-bfcd-788d481e12ed
> /usr/bin/...
0
votes
1
answer
599
views
`sudo` equivalent of `sshpass`? `sudopass`?
The sshpass programme can automatically enter the ssh password without you having
Is there anything that will do that for a sudo prompt? Like sudopass? e.g. sudopass -p SUDOPASSWORD sudo -i
Ubuntu ...
0
votes
1
answer
1k
views
sudo twice become method for Ansible
I have to deal with a setup in "/etc/sudoers" that I can't change because the servers in question are managed by a different team and they don't want to change it.
I have root access only by ...
0
votes
1
answer
6k
views
Automate SSH login WITH password [closed]
Before this question gets deleted, I already read this, this, this, and this; and most of these links don't answer my question; because:
I do need a key AND password
I run multiple servers (50+), and ...
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 ...
-2
votes
1
answer
76
views
What's the magic path for npm when using sudo?
I remember I was able to use something like sudo ${which npm} run xxx when I needed root privilege to run npm. What is it?