Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [sudo]

sudo is a tool which allows users to run commands as another user (usually the root user)

Filter by
Sorted by
Tagged with
9 votes
1 answer
810 views

Is it possible to lock sudo from the command line, without editing sudoers or logging out and back in?

When you run sudo it won't ask a password for at least 5 minutes after you last ran it. You can change this timeout by adding Defaults timestamp_timeout=0 to sudoers with sudo visudo. This also ...
user avatar
  • 567
0 votes
2 answers
27 views

Linux bash way for unprivileged user to take ownership of contents of only one particular directory?

I want a particular user to recursively change owner and group of all the contents of a particular directory, and only that directory. The directory is a kind of "inbox", where a service ...
user avatar
  • 209
0 votes
0 answers
11 views

Apache2 server fails to start without sudo first time

I have deployed my application to a kubernetes cluster that does not allow root user within pods. So I had to change the user to ubuntu. Due to this, I changed the default port of apache2 from 80 to ...
user avatar
1 vote
2 answers
53 views

How do I run sudo commands with a system user?

I want to run a minecraft server in Docker, so I started following this guide. In the guide, it is advised to create a system user with a home directory (/opt/minecraft), but without a password (you ...
user avatar
  • 111
0 votes
1 answer
28 views

DEBIAN 10 apt-get, sudo issues

I'm currently facing some issues with my dedicated server. I unfortunately removed some packages from my server yesterday. And now the man-db on my server seems not to work properly. This issue maybe ...
user avatar
  • 13
18 votes
9 answers
3k views

root login or sudo user for server administration?

I'm trying to understand the technical arguments/security implications between ssh'ing with root directly, or making an auxiliary sudo user in the context of maintaining a server. To clarify, we're ...
user avatar
  • 183
0 votes
0 answers
93 views

Problems sudoing using a host connected to Active Directory (sssd, kerberos local sudoers file)

I am configuring Active Directory authentication for an Alma 8 box using SSSD, Kerberos, and initial SSH key for log in stored in an Active Directory object, and a local sudoers file that lists groups ...
user avatar
0 votes
0 answers
25 views

/etc/sudoers is owned by uid 1000, should be 0 [duplicate]

I accidentally changed ownership of etc folder in a lightsail bitnami AWS machine. Is there a way to get the ownership back to root. The main problem seems to be that the root account doesn't have a ...
user avatar
1 vote
0 answers
100 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 ...
user avatar
  • 265
0 votes
2 answers
83 views

sudo to allow apt-get install of remote packages, but forbidding arbitrary commands

I'm looking for a way to allow a user to install (only remote) packages via apt-get (or another mechanism?) but not allow them to run arbitrary commands as root. I can get some of the way there via /...
user avatar
0 votes
0 answers
46 views

Why is sudo very slow (more than 30minutes) to display initial password prompt for a domain account?

I am hoping someone can help me figure out why 'sudo' takes longer than 30mins (on average) to display the initial password prompt when using a domain account. This problem occurs even after a reboot, ...
user avatar
  • 101
0 votes
0 answers
110 views

Command to get Sublime Text SFTP client to execute sudo at every file save

I am using Sublime Text editor with its SFTP plugin to edit files (also root files) on my server. I thought there is some linux command or file that can be edited that would enable me to execute sudo ...
user avatar
0 votes
1 answer
234 views

What am I missing to setup sudo access with openldap?

I'm using lxd/lxc containers (Oracle Linux 8) to rapidly deploy the environment (so if you have lxd setup, you can modify the ip scheme to match lxd's bridge subnet / DNS and then paste the code into ...
user avatar
0 votes
2 answers
105 views

Require root password when executing "sudo -s"

I have a CentOS 7 server on AWS. When logged in with the centos user, how can I prevent sudo -s logging in to root without requiring root's password? [root@server ~]# cat /etc/sudoers | grep rootpw ...
user avatar
  • 431
0 votes
0 answers
56 views

ubuntu sudo su takes long time

I have seen many questions related to sudo taking long time. I solved it by running script as root: echo myserver > /etc/hostname echo 127.0.0.1 myserver > /etc/hosts hostname myserver After ...
user avatar
  • 101
0 votes
1 answer
85 views

jcmd works in console but fails in script

I'm getting mad with what should be a simple task: a java process is running, runs out of memory and a script runs. SELinux is disabled. in setenv.sh : -XX:OnOutOfMemoryError='/opt/alfresco/scripts/...
user avatar
0 votes
0 answers
67 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 ...
user avatar
0 votes
0 answers
275 views

TACACS+ Ubuntu client vm authentication

I have a TACACS+ server and an Ubuntu 20.04 vm client. I downloaded the package libpam-tacplus and did steps 7 and 8 from this answer. If the user exists on the vm I can successfully use the TACACS+ ...
user avatar
0 votes
2 answers
313 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 ...
user avatar
0 votes
1 answer
89 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 ...
user avatar
0 votes
0 answers
62 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/...
user avatar
0 votes
0 answers
117 views

How do I sudo over sshfs, but on windows

I have a very similar issue to How do I sudo over sshfs?, with the exception I can't find a way to do it on windows. I need sudo privileges to write some files, but can't figure it out on windows port ...
user avatar
1 vote
0 answers
94 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 ...
user avatar
  • 11
1 vote
1 answer
137 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 ...
user avatar
  • 121
1 vote
1 answer
47 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:/...
user avatar
1 vote
2 answers
318 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 ...
user avatar
  • 13
0 votes
1 answer
286 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 ...
user avatar
  • 67
0 votes
2 answers
138 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 ...
user avatar
1 vote
1 answer
50 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 ...
user avatar
  • 271
0 votes
1 answer
357 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 ...
user avatar
  • 125
0 votes
0 answers
661 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): ...
user avatar
  • 198
0 votes
1 answer
54 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 ...
user avatar
-1 votes
1 answer
56 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. ...
user avatar
  • 99
0 votes
1 answer
216 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 = &...
user avatar
3 votes
1 answer
258 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 ...
user avatar
  • 31
0 votes
2 answers
22 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 ...
user avatar
  • 117
3 votes
0 answers
58 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 ...
user avatar
1 vote
1 answer
3k 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/...
user avatar
  • 29.9k
0 votes
2 answers
68 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 ...
user avatar
0 votes
2 answers
873 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 ...
user avatar
  • 33
0 votes
1 answer
636 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 , ...
user avatar
0 votes
1 answer
257 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 ...
user avatar
  • 101
0 votes
0 answers
41 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 ...
user avatar
  • 21
1 vote
1 answer
2k 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 &...
user avatar
  • 13
0 votes
1 answer
1k 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....
user avatar
1 vote
0 answers
34 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-...
user avatar
1 vote
1 answer
159 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, ...
user avatar
  • 86
2 votes
1 answer
8k 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 ...
user avatar
  • 611
0 votes
1 answer
799 views

CentOS 8.2 LDAP client configuration

I'm trying to configure an LDAP client on a CentOS 8.2 machine, using SSSD. The server doesn't use TLS or SSL. I have modified the following configuration files : /etc/sssd/sssd.conf [sssd] ...
user avatar
0 votes
1 answer
180 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 ...
user avatar
  • 3

1
2 3 4 5
18