how to write text files in a restricted file-share accesible by username & password in python. I was trying with the UNC of the fileshare, yet was not able to. Can Anyone help with code snippets as to how authorize as specific user in FS and write files to FS as specific user. Could be a C-user too. I thought of creating a mapping drive using python as follows:- # Drive letter: M # Shared drive path: \shared\folder # Username: user123 # Password: password import subprocess # Disconnect anything on M subprocess.call(r'net use m: /del', shell=True)
# Connect to shared drive, use drive letter M
subprocess.call(r'net use m: \\shared\folder /user:user123 password', shell=True)
How to do the same for Linux, I.e map a linux file system to a fileshare using python