Hello, I'm trying to add a file to /etc/sudoers.d/ in order to allow one 
specific user (named 'config') to run one specific program without entering 
a sudo password.
First of all, here is my privilege file,  
'files/hydra-common/sudoers/config_user'

# add config script to sudoers so the user only needs to enter the password 
on login
config ALL=(ALL) NOPASSWD:/home/config/config_startup.sh

I upload the file in my template:
 
 
{
    "type": "file",
    "source": "files/common/",
    "destination": "/tmp/hydra-common"
},

then later, in a script, I call:
echo "Moving Sudoers files"
chown -R 0 /tmp/hydra-common/sudoers/*
chmod 440 /tmp/hydra-common/sudoers/*
mv /tmp/hydra-common/sudoers/* /etc/sudoers.d/

I don't get any errors at this point, but then in the next provision shell 
step, I get the following error
    vsphere: >>> /etc/sudoers.d/config_users: syntax error near line 2 <<<
    vsphere: sudo: parse error in  near line 2
    vsphere: sudo: no valid sudoers sources found, quitting


No, if I comment out the effective line in the privilege file, I obviously 
don't get the error, but just as obvious is that I don't get the sudo 
permission for config. if I use visudo to edit the file (from root), and 
uncomment the line, visudo does not give me any errors, so I'm guessing the 
syntax is correct.
I'm thinking it might be because when the script does it, its not doing it 
through visudo which is confusing linux? At any rate, does anyone have any 
idea how to fix this?

I'm using Ubuntu 16.04 and Vcenter (with the vsphere plugin found here: 
https://github.com/jetbrains-infra/packer-builder-vsphere)

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/08d1bbef-45ad-4f15-bc86-e822b3275b15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to