The reason that doesn't work is because if you specify a remote file like that to like c:\ or /tmp chef thinks you are talking about the local file system on the node itself, it wont copy files from your workstation to the node like that.
What you could do it create a share on your workstation and then put the file(s) you want to access in there and reference that in your cookbook like this there are more examples in the remote_portion of the chef docs search for UNC.
remote_file "E:/domain_test.txt" do
source "\\\\myserver\\myshare\\mydirectory\\myfile.txt"
remote_domain "domain"
remote_user "username"
remote_password "password"
end
By mistake I forgot to add one \ in the blog. But I am using 4 times .
I am able to access share file through window url by using same domain, username and password.
But no through chef. Facing same error.
Are you on a active directory domain? You also may need to make a change to your workstation firewall to allow the connections you would need to allow connections over port 445.
I created a local share and gave my user account implicit full access to the share
under sharing I clicked advanced sharing checked the box, gave the share a name of share$, then I clicked permissions, added my user account and gave it full access. then clicked ok.
I then made a quick cookbook with a recipe as follows.
directory 'c:/test' do
action :create
end
remote_file 'c:/test/test.txt' do
source '\\laptop.company.com\share$\test.txt'
remote_domain 'company.com'
remote_user 'larryc'
remote_password 'Hunter2'
action :create
end
and it worked as expected
Recipe: filecopy::default
* directory[c:/test] action create (up to date)
* remote_file[c:/test/test.txt] action create
- create new file c:/test/test.txt
- update content in file c:/test/test.txt from none to e3b0c4
(no diff)
You might want to check that your share has the proper permissions.