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
27
views
How do you allow user_t SELinux users the ability to use sudo
I've got three classes of user that I have assigned to staff_t, user_t and guest_t. However the default permissions of these user types don't exactly correspond to what I need. It seemed easier to use ...
0
votes
1
answer
25
views
Why can I connect to the docker daemon with sudo, but not root?
Consider the following sequence of commands. When I try to connect to the docker daemon as a regular user, or root, I can't. When I use sudo (both as a regular user and root) I can. Why is this?
[john@...
0
votes
0
answers
24
views
Need to enable restart button on GUI Ubuntu Server 22.04 + XFCE4 + sddm
Currently I have 2 users: root and gigi.
gigi is not sudoer and cannot be, BUT, needs to have the possibility to reboot the server through 2 ways.
1º -> through terminal. I edited visudo and now I ...
1
vote
1
answer
4k
views
winbind separator and group name behavior in getent group, constantly changing
I have a problem that occasionally apprears-dissapears and it drives me nuts.
My Debian servers are authenticated against AD and only "linuxadmins" group member can SSH to server and "sudo su".
SSH ...
127
votes
18
answers
151k
views
Why does sudo command take long to execute?
I've been picking up Linux (Fedora 10, then 11) over the past few months (and enjoying it immensely-- it's like discovering computers all over again, so many things to learn).
I've added my user to ...
0
votes
2
answers
872
views
can not sudo to root in Ubuntu instance
I have an error when i want to become root
╭─saviam@server ~
╰─$ sudo -i ...
9
votes
5
answers
40k
views
sudo does not prompt for password and reports 3 incorrect password attempts
User smithj is listed in the /etc/sudoers file:
root ALL=(ALL) ALL
smithj ALL=(ALL) ALL
smithj logs into the system via putty. He attempts to sudo but gets this:
sudo adduser jonesjp
Sorry, try ...
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 ...
0
votes
1
answer
69
views
Need help managing per-machine per-user sudo permissions in a research network environment using saz-sudo and Hiera with Puppet
Currently our Puppet server has an /etc/sudoers file defined with the permissions for every user on every machine in our network. This file is distributed equally to every host to provide permissions. ...
0
votes
1
answer
100
views
su: failed to execute 1 sudo dpkg-reconfigure locales: No such file or directory
I was configuring a linux server and after an apt upgrade this message came up whenever I try to change the user to root.
If I do sudo su -, su -, sudo -i I cannot change user because it says that
su: ...
4
votes
3
answers
6k
views
Remotely use root over ssh for unison
I'm a little confused on how to run unison to sync files with group and owner attributes on an ubuntu system, as you need to be root. But I need to do this remotely and automated. I know I can set up ...
0
votes
1
answer
103
views
How to start a sudo-privilage program with screen so that I can re-attach to it later?
Here's the problem I face: I have a program that must run as root. I want that to run in a screen, but here's a twist: for admin reasons, I want to be able to re-attach to it.
I'm writing a dirty and ...
0
votes
1
answer
141
views
After run sudo and/or su or su - command, the command prompt not loaded, however the switch user is successful
I saw a maybe similar thread but not sure there the issue is the same:
su command not responding?
I have an Ubuntu 20.04 LTS baremetal server.
After run sudo and/or su or su - command, the command ...
19
votes
2
answers
11k
views
Sudo directive in /etc/sudoers.d doesn't work (but it's fine if it's in /etc/sudoers)
I wish to add a file to the /etc/sudoers.d folder that includes a directive to allow www-data to run one specific script with no root password.
The directive is
www-data ALL=(ALL) NOPASSWD: /path/to/...
1
vote
1
answer
305
views
sudo with Kerberos credentials
We are on Oracle Linux 7.9, which is part of a Kerberos realm.
I would like account foo to be able to execute (without any password) one command as account bar with Kerberos credentials of bar ...
0
votes
1
answer
70
views
get user with crontab root
I run myscript.sh scheduled in the root crontab and I need it to detect the non-root user (with which the system starts).
I have tried these variants:
local_user=${who -m | awk '{print $1;}'}
...
214
votes
8
answers
348k
views
How to setup passwordless `sudo` on Linux?
How can passwordless sudo access be setup on either RHEL (Fedora, CentOS, etc) or Ubuntu distributions? (If it's the same across distros, that's even better!)
Setting: personal and/or lab/training ...
0
votes
1
answer
219
views
is /etc/sudoers writable or not
The default permission in /etc/sudoers file is readonly for root and group root as in picture is obvious :
So when you open it with any test editor it can't be written and give error read only.
now ...
5
votes
1
answer
1k
views
Why can't I use pam_echo.so in the sudo pam stack?
I have a CentOS 7 machine where I'd like to display a message when authentication fails during sudo. I tried to do this by adding a pam_echo line in /etc/pam.d/sudo.
For testing, I created a file, /...
2
votes
4
answers
5k
views
Using a non-root to deploy a git repo to the web root
What is the best way to set up users and permissions for a production web server that uses git to deploy to the server?
Background
Running Ubuntu 12.04, I have apache serving files under /var/www as ...
0
votes
0
answers
156
views
Sudo validates command line arguments via regular expression incorrectly
Let's say we have two users: alex and alexa. We want to allow alex to execute htop as root in order to see disk usage stats, but we do not want them to see other users' processes which root can do. ...
10
votes
5
answers
5k
views
Limiting the use of `sudo -s`
I am setting up Nagios on some of my Linux servers and have run into a bit of an issue. The check_ide_smart plugin requires root access to the system to run. To run it, I use the check_by_ssh plugin ...
0
votes
1
answer
1k
views
Setup A Program to Run At Startup As A Specified User On Linux
I have a server running Debian 12 that does not have root access enabled as recommended by many. I do have an another user admin privileged account on the server.
I have a program that does not come ...
3
votes
2
answers
382
views
Flexible sudo access
I want to be able to give a user on a system I administrate the ability to access file X, using command Y using sudo.
Is there a way to do this while allowing some flexibility over the arguments to ...
15
votes
8
answers
25k
views
Every single time I use sudo it hangs before completing
Whether I get prompted for a password or not, it hangs between accepting the authentication and executing what I asked for. In other words sudo ls will hang for about 60 seconds.
I'm confused about ...
1
vote
1
answer
126
views
sudo file in sudoers - why user can modify file?
I want to allow one user to run specialscript.sh as root
so in his folder i created
-rwxr---- 1 root deployers 142 Jul 16 14:07 specialscript.sh
and in sudoers.d/specialscripts:
user123 ALL=(...
-2
votes
1
answer
121
views
Sudo user running app: can it be elevated to be root by app?
Sudo user running app: can it be elevated to be root by app?
e.g.,
user "user_xyz" is a regular user in sudo group.
sudo command
Does not require password.
If the user run an app, can the ...
14
votes
4
answers
8k
views
Is it insecure to have an ansible user with passwordless sudo?
I'm new to Ansible. Most VPS provisioning guides I've seen so far do this:
disable root from logging in
create a new user who can only log in with ssh (not password)
add the new user to the wheel ...
2
votes
1
answer
774
views
Privilege escalation prevent root directly
I think this is going to be my first post on StackExchange side of the house. However, I know that this has to be able to be configured cause I have seen it implemented previously but I don't actually ...
5
votes
1
answer
7k
views
Ansible become_user not picking up path correctly
Here's the code showing what I believe is a problem:
# Debugging path problems with sudo
---
- hosts: webservers
remote_user: root
tasks:
- name: echo path
command: echo $PATH
register: ...
60
votes
10
answers
250k
views
how to use xauth to run graphical application via other user on linux
My regular user account is, let's say, user1. I created separate user2 for some x application that i would like to run while being logged into x as user1 but in a way that will prevent it from read/...
0
votes
1
answer
1k
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 ...
1
vote
3
answers
832
views
Edit a remote file in Vim with sudo when ssh root login is disabled
I am trying to determine a way to edit remote files in Vim that require sudo, but still use my local vim config and plugins.
Currently I can open vim and :e scp://me@server//some/root/file and make ...
0
votes
4
answers
425
views
Is it safe to allow any user to see the status of all services?
I would like to allow every linux user to see the status of all systemd services.
I created these lines for the /etc/sudoers file:
ALL ALL = NOPASSWD: /usr/bin/systemctl is-active *
ALL ALL ...
2
votes
1
answer
953
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 ...
0
votes
1
answer
995
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 ...
0
votes
1
answer
599
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 ...
6
votes
2
answers
4k
views
User not in sudoers, but still can use sudo
I have a user user1 that is not in the sudoers file (nor belonging to groups in sudoer) but can still use sudo. How is it possible ?
user1~$ groups
user1 www-data
My sudoer conf
...
0
votes
1
answer
224
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 ...
0
votes
1
answer
2k
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 ...
0
votes
9
answers
3k
views
How can I run sudo commands without sudo access?
I need to run this:
sudo adduser ...
50
votes
7
answers
28k
views
How do I sudo over sshfs?
On my local host alpha I have a directory foo that is mapped via sshfs to host bravo as follows:
$ sshfs charlie@bravo:/home/charlie ~/foo
However, on host bravo there is another user, delta, that I ...
8
votes
6
answers
9k
views
Broke my /etc/sudoers file on amazon EC2
I edited my Linux Amazon EC2 instance using vim /etc/sudoers and tried adding another account to the list. I realize now that this was a terrible mistake. I can no longer sudo from any account (which ...
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 ...
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
1
answer
52
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
...
0
votes
1
answer
227
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: ...
0
votes
1
answer
432
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 ...
1
vote
1
answer
3k
views
mkdir is not working with sudo and shell option
One of the application trying to create directory failing with the below error on Linux machine:
$ /usr/bin/sudo -su oracle /bin/sh -c '/bin/mkdir -p /u01/app/oracle/test12'
/bin/mkdir: missing ...
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
$ ...