How to access network drive folder using credentials in R?

Viewed 364

In my company we have Network Drives where we store flat files e.g. ".txt" files. I have access to a specific folder of a network drive (e.g. "DNS_DRIVE\folder_name"), by using my Windows Credentials. So I login to a Workstation (Workstation has network access to specific Network Drive) with my credentials (e.g. username:xxxx, password:yyyy) and in R Console I use the following command:

fread('//DNS_DRIVE/folder_name/flat_file.txt'),sep='|')

in order to read flat file and this works fine.

We managed to set an ML Server (R Server) (one-box configuration). When connected to ML Server (user:admin) I can't access Network Drive. Repeating the same code

fread('//DNS_DRIVE/folder_name/flat_file.txt'),sep='|')

returns the following error message:

Error in file(file, "rt") : cannot open the connection

I should mention that ML Server is set on a Server (i.e. "DNS_ML") that has network access to wanted Network Drive ("DNS_DRIVE\folder_name"). That means that if I use Remote Desktop and Login to "DNS_ML" using credentials username:xxxx, password:yyyy I can access "DNS_DRIVE\folder_name".

Is there a way to use in R specific credentials in order to have access to Network Drive? Is there a configuration file or a library that could be used?

0 Answers
Related