-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy a file using pysmb from windows to linux #213
Comments
@prathishpkr Yes, pysmb can be used to copy file between Windows and Linux Samba service. |
@miketeo, i have tried to upload the file from local to Samba server using storeFile method, there am getting the below issues NFO:SMB.SMBConnection:Authentication with remote machine "IP address" for user "osboxes" will be using NTLM v2 authentication (with extended security) |
@prathishpkr try to modify the smb.conf on the Samba service, and restart your Samba service.
More information at https://www.cyberciti.biz/faq/how-to-configure-samba-to-use-smbv2-and-disable-smbv1-on-linux-or-unix/ |
@miketeo, could you please assist me for test file for this below code, do we want to define the function 2 times for connection for SMB2 and SMB, cause below code am not able to upload the files and also large amount of data will support to transfer storefile ? class SMBNetworkShare():
|
Can you correct the formatting for your code? |
@miketeo could you please check above format now, please check and let know. |
The parameters to the SMBConnection are incorrect. The order should be userID, password, client_machine_name, server_name, use_ntlm_v2. The server_name must be the remote Samba name, e.g. MYSERVER, or SAMBA. You need to check your Samba configuration or try to use your Windows explorer to browse for the exact name. It's probably safe to drop support SMB and focus on supporting SMB2 in your app. |
@miketeo Could you please assist me, have try to find the document of to get the list of files presents in subdirectory/subfolder and the filesize checked for destination location (remote location ), is that support os.walk() which is support for localfile to fetch the list of files details(it should retrieve the files of all file format, including subdirectory/subfolder inside files) and for filesize can we retrieve the information if use the below method destination_file_info = self.conn.query_info(self.smbDestFolder) # get_attributes(self.smbDestFolder) could you please share the documents, if we use above method. |
Copy a file using smb from windows to remote linux and linux to remote windows, is that possible using retrieveFile() or storeFile().
import smbclient
from smb.SMBConnection import SMBConnection
def Copy_data_linux_to_windows(source_file, destination_file, username, password, server_ip, share_name):
try:
conn = SMBConnection(username, password, '', '')
if name == "main":
source_file = "/tmp/Copy_dir/Python_Test.zip"
destination_file = r"W:\Python_Test.zip"
#destination_path ="C:\SMB\Python_Test.zip"
username = "uname"
password = ""paswrd
server_ip ="ipaddress"
share_name = "share_name"
The text was updated successfully, but these errors were encountered: