Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sudo]

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

1
vote
1answer
23 views

Ansible module_stdout: command not found when using sudo on Centos 7

I am connecting to centos 7 virtual and physical machines using ansible with a user called ansible that has passwordless sudo permissions on all the boxes. On most machines it works, but on one box I ...
0
votes
1answer
28 views

redirecting output using sudo [duplicate]

I want to run a command as another user using sudo, and redirecting the output of that command as that user. Example, if I run: touch some-file under user simon, some-file will be owned by user ...
0
votes
1answer
29 views

Switching to a “role” account, using `sudo` and `ssh` agent forwarding later on – possible?

I want to create "role" accounts for several admin tasks that don't usually require root permissions. For example, consider a www-admin user maintaining files in /var/www. It seems to me that this is ...
0
votes
0answers
23 views

How to connect with root on ec2 without sudo? [duplicate]

I made a mistake. I used sudo chown -R 775 on /usr/bin instead of using sudo chmod -R 775 (don't judge me please). So now i'm stucked with ec2-user and i can't use sudo anymore. What can I do ? I'm ...
0
votes
0answers
52 views

SSH connection getting closed automatically after a sudo command

I have two servers running the same version of RedHat 6.4, however one of them behaves differently when I run remote sudo commands through SSH on it. On server1, the connection is automatically closed ...
0
votes
1answer
52 views

convert upstart to systemd - run command as root, spawns command off as another user

I need help with converting an upstart .conf into a systemd .service. Essentially what my .conf file does is this: exec su -l foo -c 'cd /var/www/path/to/file ; bundle exec puma -C config/puma.rb' As ...
0
votes
1answer
63 views

'ALL=(ALL) NOPASSWD: ALL' not working

restricting root ssh access works perfect in centos 6 but using the same method fails on centos 7. what are we doing wrong? an interesting point is that in our centos 6s we have stated that only our ...
3
votes
1answer
90 views

Configuring Sudo using SSSD

Trying to Login to Linux systems using windows AD account. Configured successfully using SSSD. Used LDAP as Identity & Access Providers and Kerberos as the Authentication provider. I have done ...
1
vote
1answer
38 views

give apache ID permissions to list and CRUD files as OS users

I wasn't sure if this question belongs here or on SO. I can move it there if needed. In any decent Apache configuration, Apache will run as its own ID; www-data for example. And this ID will not have ...
1
vote
0answers
47 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 ...
2
votes
0answers
57 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) ...
-1
votes
1answer
222 views

sudo user is not allowed to execute systemctl

I'm trying to allow a user to use sudo to manage a custom systemctl service, this however seems to fail and I can't figure out why. [root@testvm sudoers.d]# ll total 16 -r--r-----. 1 root root 334 ...
0
votes
2answers
53 views

How to make sudo commands work over ssh without asking for a password?

I set up a server to accept ssh without passwords, and it works fine for nonprivileged commands. However, when I try to run sudo commands, I'm still asked for a password: $ ssh -t test@192.168.1.52 "...
0
votes
0answers
17 views

Minimum permissions for user vagrant to manage box

I'm using vagrant with an ubuntu 14.04 image for my project and I aim for least privilege for the user vagrant. I will not get into details of the motivation for simplicity sake, but let's say it's ...
-3
votes
1answer
160 views

Google Cloud Compute Engine CentOS 7 Sudo command

Till Friday 12/10/2018 I was able to run sudo commands (Ex:sudo mongodump --db iot_ac). Today When I tried to run any command as root(sudo),i get the below message(Connected through SSH): We trust ...
1
vote
1answer
65 views

Sudo: cannot setup user to avoid being asked for password

I run: sudo visudo and set this line for my user myuser ALL=(ALL) NOPASSWD: ALL however, I am still asked a password when I run a sudo command how can I setup the user so that the password ...
0
votes
1answer
52 views

How to create sudo rules to access non-root local accounts that prevent any action being taken on a specific file?

I have the following rule set that allows a group to run any command as user "apache": %Test_team ALL=(apache) NOPASSWD:ALL I want to limit the ability to run any command (cat/cp/rm/vi, etc) on ...
0
votes
0answers
108 views

How to use “sudo” for installing an app on gitlab.com for CI?

I have a project at gitlab. I'm setting up Continious Integration for it. I need to install sphinx search engine and it requires sudo. - http://sphinxsearch.com/files/sphinx-3.0.3-facc3fb-linux-amd64....
0
votes
0answers
111 views

CentOS sudo fail when using pam_faillock.so

This refers to another question at sudo does not prompt for password and reports 3 incorrect password attempts The problem is, when the following line was added to /etc/pam.d/system-auth-ac to fix ...
1
vote
3answers
76 views

Why /etc/sudoers failed when doesn`t use absolute path?

I want to give my account nova sudo priviledge so I add this configure to /etc/sudoers Defaults:nova !requiretty nova ALL = (root) NOPASSWD: /openstack/bin/nova-rootwrap /etc/nova/rootwrap.conf * ...
0
votes
2answers
94 views

Use non default route as non privileged user

On Ubuntu 16.04, the default route for IPv4 is an interface other than eth0. If I try to curl -vvv --interface eth0 v4.ifconfig.co I get * SO_BINDTODEVICE eth0 failed with errno 1: Operation not ...
0
votes
1answer
838 views

Restart or reload Apache as “www-data” user

I have a webhook script written in Python on my Debian/Apache2.4 server, so that it runs a deploy .sh script when pushing on GitHub. So, the script is executed by standard Apache user "www-data". My ...
1
vote
0answers
31 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, ...
2
votes
1answer
105 views

docker-machine with “generic” driver: security concerns

I want to use docker-machine to deploy containers on a Debian 9 server from my local computer. I followed instructions from this page, which clearly indicates: If you are using « sudo » on the ...
1
vote
1answer
302 views

sudo followed by another command in ssh heredoc not working

This is my script: #!/bin/sh echo "I'm local" ssh -t -t remote.server << 'EOF' sudo echo "I'm remote and sudo" echo "I'm remote but not sudo" exit EOF This simply doesn't work, ...
0
votes
1answer
388 views

Sudo not working. How to reset root password Ec2 (AWS)

I installed a SSL certificated the day before. Today I wanted to log in to the server. When I try to "sudo" it gives me the following error message: sudo: unable to stat /etc/sudoers: No such file or ...
0
votes
1answer
42 views

Moved libnspr4.so, now cannot sudo

When trying to solve another problem. I ended up moving libnspr4.so to my home folder. Now when I try to copy it back to /usr/lib64 folder it says sudo: unable to dlopen /usr/libexec/sudoers.so: (...
0
votes
2answers
57 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 ...
0
votes
0answers
17 views

Keep local environment variables with policy kit?

Both sudo and policykit (pkexec) restrict the amount of environment variables one could use when executing a program via them. I have recently learned that sudo allows program builders a way for ...
0
votes
1answer
38 views

Is it fine if an external program edit the sudoers file?

My program needs some local environment variables while running as root to perform certain tasks. Would it be fine to write a subroutine that can change users sudoers to keep these variables? It's not ...
1
vote
3answers
160 views

Access a linux server without being on the sudoers file

I have my Jenkins installed on a windows server and I have created a Jenkins user on the server now I need to push the WAR files to my Linux server to a particular user root (myrootuser) who is there ...
0
votes
0answers
77 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
votes
1answer
137 views

`sudo apt-get -f install` fails everytime [closed]

This command sudo apt-get -f install fails every time I try to run it.
3
votes
2answers
2k views

Checking sudoers.d files with Ansible

I have an Ansible playbook I use to manage our sudoers files across our environment. We like to keep a minimal sudoers file at /etc/sudoers, then anything we want to add gets put into separate files ...
0
votes
2answers
102 views

Call app with sudo and custom environment variable

I need to call sqlplus with oracle user sudo to clearly specified DB (env var ORACLE_SID) by one line command. The usual way to do it consists of 2 steps: $ sudo -u oracle -i $ ORACLE_SID=DBNAME ...
1
vote
0answers
37 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
1answer
297 views

Allow user to sudo as any user in group

I'm running a service where I have users that are running services from their home directories. They are all in the group serviceusers, and I have a user that will perform automated tasks initiated ...
9
votes
4answers
1k views

linux command found but not found when using sudo

I am trying to run a python3 install like this: pip3 install django I get the error: PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/site-packages/pytz' I then try: ...
3
votes
1answer
310 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, /...
0
votes
1answer
210 views

doas on FreeBSD does not respect 5 minute timeout

I've setup doas to run on FreeBSD 11.1 as per these instructions and added the following line to my doas.conf: permit persist :wheel I've noticed that I need to insert my password every time I run ...
0
votes
1answer
22 views

Does 'sudo' extend its timeout every time you use it?

If I use sudo, and type my password in, I can continue to use sudo without my password for 15 minutes. I know (per man sudoers) that I can edit the timeout by setting the timestamp_timeout value in /...
0
votes
1answer
1k views

SUDO NOPASSWD not working on a specific command

I have a tricky situation. I need a user nagios to execute a specific command as another user jenkins -- However this command only works if the jenkins environment is fully loaded. Otherwise the ...
0
votes
2answers
97 views

File specific visudo permissions

I'm trying to integrate some bash scripts into a website admin area. Background I'm running apache on Ubuntu server. Giving apache (www-data) sudo rights is far from ideal, so I'm not going to. ...
0
votes
1answer
153 views

Linux ksu (kerberized super user) command fails to use cached service (host) tickets

Questions at the end About my environment I have tried in two different environments: (i) Linux Ubuntu 16.04LTS server enrolled in Active Directory (Microsoft) Domain and (ii) Linux Ubuntu 16.04LTS ...
1
vote
2answers
707 views

Can a line in a file in the /etc/sudoers.d directory have multiple users?

I've got the following file setting permissions on my machine: /etc/sudoers.d/myuser This has the following contents: myuser ALL=(myuser) NOPASSWD: ALL I'd like to add a second user to this list, ...
1
vote
1answer
67 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
votes
1answer
55 views

visudo + read access to file from non root user

how to access file by visudo from non root user , or other option for example when we change user to hdfs and from user hdfs we want to print the file - file.cfg we get Permission denied how to ...
0
votes
0answers
114 views

Sudo is taking forever to run the first time

I am running into this issue where the first time I run sudo the command takes about 30 seconds before it will prompt me for my password. (NOTE: after I have entered my password, all the following ...
0
votes
1answer
86 views

Running a command from apache user as ec2-user

I'm trying to run the following command /usr/bin/ocr 1.pdf 1.xml from Apache, but unfortunately this command only works with ec2-user. So I've tried to edit my PHP file to make it run like that: /...
1
vote
1answer
568 views

Packer with ansible from local works but from another server ask for root permissions

For a bit of context, I'm using packer with an ansible provisioner to create AMI images on AWS. The relevant parts of the packer and ansible: packer.json "provisioners": [{ "type": "shell", "...