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
0 votes
1 answer
49 views

Sudoers NOPASSWD not working for specified commands

I have the following entries in the sudoers file: christian ALL=(root)NOPASSWD: /usr/sbin/shutdown christian ALL=(root)NOPASSWD: /usr/bin/systemctl start mc When running sudo shutdown -h now or sudo ...
Apollo's user avatar
  • 113
2 votes
1 answer
117 views

Is sudo -u username command the same as doing sudo -i -u username then command?

Is a terminal prompt sudo -u username command same as doing sudo -i -u username then command in the next line? If no, what is the differences? What are the use cases when doing the first is better or ...
joyoy's user avatar
  • 21
0 votes
1 answer
135 views

Nsswitch - sudoers sss vs ldap what am I missing

I'm trying to configure nsswitch to use sudoers: files sss which is default for rhel9 system, however this does not work for me, but the following sudoers: files ldap does indeed work. What am I ...
N. J's user avatar
  • 131
0 votes
1 answer
86 views

Apache Authentication - Find out user password

My field of expertise is far away from server management but I am currently covering for a former collegue of mine, so I apologize in advance if my question doesn't make sense. I have to restart an ...
Mariya Mihaylova's user avatar
0 votes
1 answer
88 views

i am root but ufw status says 'command not found'

as simple user, first I pass root with command : su I am now root on Debian 10 buster. When I hit ufw status, I have 'command not found'. But it works with sudo ufw status When I use su -, the command ...
rach's user avatar
  • 1
0 votes
1 answer
279 views

Sudo privileges limited to a specific group of users

I'm configuring our new Ubuntu 22.04 VPS to host our react app and REST API. I followed this tuto that seems relatively advanced and complete : https://gofoss.net/server-hardening-advanced/ I'm ...
Emmanuel FRANCOIS's user avatar
0 votes
1 answer
179 views

Getting command not found using sudo, but not for running command as root without sudo

wierd issue where if you use sudo command for certain commands it is not found. But runnning it as root user WITHOUT sudo does work root@ip-172-31-43-153:/home/ubuntu# sudo xfs_growfs -d / sudo: ...
user2958456's user avatar
1 vote
1 answer
35 views

Selective EXEC with LDAP-based sudo

I'm trying to translate this sudoers file into LDAP: Defaults env_reset, env_keep="LESSSECURE SSH_CLIENT", !authenticate, noexec, requiretty, secure_path=/usr/local/bin:/usr/bin:/usr/sbin ...
miken32's user avatar
  • 912
0 votes
1 answer
106 views

Why create a new user with sudo privilege when you are the only person manage the server?

Please share some true use cases of benefits when you are the only admin of manage VPSs, I'm just hosted my first WordPress site. A lot of guide I read online suggests creating a new user after update ...
Maxfield's user avatar
  • 103
0 votes
0 answers
50 views

Disable apt command for the particular sudo user

I am IT admin in the company. The developers ask to have sudo permission to execute sudo systemctl status/reload/start/stop serviceName to manage their app. But my boss doesn't want them to be able to ...
ITnewbie's user avatar
  • 171
0 votes
1 answer
24 views

Sudo: Using arguments in /etc/sudoers.d/ file, particularly with mount (visudo rejects syntax)

I have a syntax wrangling problem with sudo that may not be solvable. I know I know, OpenBSD's new doas is better than sudo, but it is not available on CentOS 7 or Rocky 8. So we're stuck with sudo ...
ping-me's user avatar
1 vote
0 answers
949 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 ...
Caledonian26's user avatar
1 vote
4 answers
1k views

Execute root commands through ssh user

my goal is to execute commands as root user from another linux host through ssh. The Problem is: The environment doesnt allow to access the root user directly. The manual way, which works, is to ...
Troubadix's user avatar
0 votes
1 answer
92 views

sudoers with other user and colon ":" char

I require a sudoers to be able to execute following command sudo -u myAppUser /opt/myapp/bin/myapp.Console.pl Admin::User::Add <some optional parameters> I've created a group myAppExecGroup and ...
cilap's user avatar
  • 277
1 vote
1 answer
996 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 ...
Carsten's user avatar
  • 11
1 vote
0 answers
85 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:...
ivanlan's user avatar
  • 111
3 votes
3 answers
462 views

Administrative access to a server via SSH key

Is it a good idea to set the SSH key directly for the root user for administrative access to a server? Or is it better to use another user for SSH access via SSH key, followed by sudo command? Is the ...
phanaz's user avatar
  • 360
0 votes
0 answers
141 views

excute script with sudo using plink remotely

hi I have a shell script that I need to excute remotely from a windows machine in a freebsd vm im using plink to do it but unfortunately it's not working i followed the documentation and here is my ...
ossama assaghir's user avatar
1 vote
1 answer
1k views

Running Shell Script without a Password Prompt

I have a shell script that runs on a freebsd OS. the script has some commands that needs the sudo privileges Im excuting the script remotley and it's skipping the sudo commands i tried the following : ...
ossama assaghir's user avatar
2 votes
1 answer
366 views

Allow users to use -D (--chdir) option with sudo

I want to make user bob able to use the -D option in sudo (like sudo -D /home bash which would open a root shell on /home). How can I do this and what are the security implications to this?
luihum's user avatar
  • 23
0 votes
1 answer
250 views

How to run a command as systemd DynamicUser

I am setting up a daemon for a web service and I want to use the systemd DynamicUser=yes feature because it seems cleaner not pollute the user table with a different user for each service. As is ...
cmc's user avatar
  • 657
0 votes
1 answer
219 views

Sudo: How can I exlude one specific command line argument from sudo

There is a command (say: mycommand) that we want to add to sudo for all users, but there is one specific command line option -i that we want to exclude. Complicating factor is that command line ...
Kees C's user avatar
  • 1
0 votes
1 answer
1k views

Can you access VM instance in Google Cloud without being root?

I'm trying to access GCP VM instance but I messed it up and now I'm getting this error: sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set but I don't have the root password. Is ...
Allen Chen's user avatar
9 votes
1 answer
1k 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 ...
Dagelf's user avatar
  • 605
0 votes
2 answers
156 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 ...
Charlweed's user avatar
  • 219
1 vote
2 answers
226 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 ...
Roger's user avatar
  • 111
0 votes
1 answer
148 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 ...
Kuezy's user avatar
  • 13
20 votes
9 answers
6k 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 ...
alex.b.bg's user avatar
  • 143
0 votes
1 answer
642 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 ...
motorleague's user avatar
0 votes
0 answers
34 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 ...
Abhishek Rai's user avatar
1 vote
0 answers
300 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 ...
Nishant's user avatar
  • 265
0 votes
2 answers
738 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 /...
Michal Charemza's user avatar
0 votes
0 answers
268 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 ...
Adam Alleman's user avatar
1 vote
1 answer
645 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 ...
thistleknot's user avatar
0 votes
2 answers
408 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 ...
Nuno's user avatar
  • 533
1 vote
1 answer
276 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/...
Francesco Papini's user avatar
0 votes
0 answers
275 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 ...
user1548815's user avatar
0 votes
2 answers
626 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 ...
Sarthak Saxena's user avatar
0 votes
1 answer
641 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 ...
Bogdan Stoica's user avatar
0 votes
0 answers
213 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/...
TheEagle's user avatar
  • 101
1 vote
0 answers
161 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 ...
Jose's user avatar
  • 21
1 vote
1 answer
231 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 ...
Apricot's user avatar
  • 121
1 vote
1 answer
68 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:/...
Patrick Bucher's user avatar
1 vote
2 answers
831 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 ...
alvan's user avatar
  • 13
0 votes
1 answer
537 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 ...
Codejoy's user avatar
  • 97
0 votes
2 answers
310 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 ...
Whois_me's user avatar
1 vote
1 answer
261 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 ...
secavfr's user avatar
  • 281
0 votes
1 answer
657 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 ...
KKE's user avatar
  • 135
0 votes
0 answers
2k 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): ...
loris's user avatar
  • 232
0 votes
1 answer
64 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 ...
Rayen Ben Said's user avatar

1
2 3 4 5
18