Anyway to ‘sudo su’ to another user when running recipe using Knife? Need to run as non-root user, which works fine, but I also need to su to a different user (BTW, I don’t have the password, it’s a NOPASSWD user to allow sudo su). Knife allows: knife shh “chef-client” -x myUserName -P ‘xxxxx’ (sometihng like a --su-user-name arg would be nice). Anyone know a way around this problem? Looking at using --identity-file option. Could I use knife without SSH user/passwd by using key auth in identity file. If so, please provide info. Not sure what needs to be in identity file (i.e. format to identify encryption used, etc…).
Thought this would work:
knife ssh my.node.com ‘chef-client -o “recipe[recipe_to_run]”’ --ssh-user suUser --identity-file .ssh/id_rsa --manual-list
.ssh directory has authorized_keys, id_rsa, id_rsa.pub for suUser
got: WARNING: Failed to connect to my.node.com – Net::SSH::Disconnect: connection closed by remote host