Hot answers tagged sudo
Here are some things I can think of:- You deploy sudoers via a central source using some configuration management system. The file exists on an NFS share mounted by multiple hosts. A particular system uses many UTS namespaces (different containers have different hostnames) You may intend a particular set of permissions on a particular hostname (which ...
Unless you want to run the command as root you need to specify the username, so su - apache -s /bin/bash sudo -u hremotessh /home/hremotessh/scripts/redirect.sh 8892 8893 is the correct syntax to test the sudo command. Since you're not prompted for the apache user's password sudo seems to be configured correctly. The resulting warning: hremotessh ...
With ansible, you can use sudo or su: - hosts: example.com gather_facts: False su: yes su_user: root tasks: - shell: whoami You could also do that from the command line: ansible-playbook --su --su-user=root --ask-su-pass playbook.yml This functionality has been available since this pull request, and is present in current 1.6.6.
In case it's useful to someone else: I just ran into the same symptoms but the answer had nothing to do with sudo configuration. Instead, it mattered which user I was trying to su to. The target user was a service pseudo-user (jenkins) which had /bin/false as its shell. The fix was to change the shell to a valid one (using chsh).
You don't tell us how big your environment is, but if it's more than one machine you may also want to consider configuring sudo using LDAP s an alternative to editing sudoers locally (either through visudo or using the /etc/sudoers.d fragments method). LDAP configuration is a well-tested way of making sure that multiple machines have the same sudo ...
Puppet makes some assumptions about the permissions of some files in /etc/puppet (and the directory itself, I believe). As such, you likely will not be able to make that location writeable to your regular account. This is usually not a good choice anyway. If you want to work in /etc/puppet directly, you should work as root - sudo is an ill fit here. Try ...
Only top voted, non community-wiki answers of a minimum length are eligible