I know this is an old question ... but, looking at the original question, it looks like the user just wanted to run the command as root .. what should I do when I looked for the answer and stumbled across the whole question.
So, itβs worth knowing, in my opinion:
vagrant ssh servername -c "echo vagrant | sudo -S shutdown 0"
"tramp" is the password passed to the sudo command because, as we all know, the roaming account has sudo privilages, and when you are sudo, you need to specify the password of the user account, not root .. and of course, by default , the password of roaming users is "roaming"!
By default, you need root privilages to shut down, so I think closing is a good test.
Obviously, you do not need to provide a server name if there is only one for this wandering environment. In addition, we are talking about the local vagutal virutal machine for the host, so there is no security problem that I can see.
Hope this helps.
Chris Barnett Feb 26 '17 at 19:23 2017-02-26 19:23
source share