If you want to use SMB folder sharing for vagrant on a windows machine, you will need to run the CLI as administrator and then provide the login and password. The problem is that MinTTY and Cygwin do not support the no-echo TTY mode.
To fix this I use this code snippet:
# Capture username and password for smb synced folders (Windows)
if OS.windows?
puts "\e[36mDue to MinTTY and Cygwin not supporting the no-echo TTY mode"
puts "it is necessary to request your account username and password"
puts "at this stage in order to correctly setup SMB shared folders.\e[0m"
puts
if !parameters['smb_username']
print "\e[35mEnter username:\e[0m "
STDOUT.flush
smb_username = STDIN.gets.chomp
else
puts "\e[32mUser name is already supplied in parameters.\e[0m"
puts
smb_username = parameters['smb_username']
end
if !parameters['smb_password']
# 8m is the control code to hide characters
print "\e[35mEnter password:\e[0m \e[0;8m"
STDOUT.flush
smb_password = STDIN.gets.chomp
# 0m is the control code to reset formatting attributes
puts "\e[0m"
STDOUT.flush
else
puts "\e[32mUser password is already supplied in parameters.\e[0m"
puts
smb_password = parameters['smb_password']
end
end
Hello,
where do I have to add this code?
Sorry, I’m Newbie..
Thanks in Advance!