Questions tagged [pysmb]
24 questions
5
votes
0 answers
pysmb copy file from Ubuntu to Windows network share folder
From Ubuntu I am able to use pysmb to connect to a Windows network share and then list off all available shares and list all files and folders of the root of that share but nothing further down the tree. I need to access a folder 5 folder levels…

S.G.
- 109
- 14
3
votes
0 answers
PySMB connects but can not store file
I am trying to create a simple script to upload a file to a windows share. SO far I get connection, and the script even creates an empty file perfectly fine. But the data doesn't quite make it.
The bellow code seems to establish the connection ok…

ck3mp
- 391
- 5
- 18
3
votes
1 answer
Store file to local server with pysmb
I'm writing a script to sync a folder with a shared folder on a local synology nas. I am able to connect, read the files, and remove no problem but am stucking at copy (storefile).
The docs from pysmb are this
storeFile(service_name, path, file_obj,…

andrewgi
- 620
- 1
- 7
- 22
2
votes
1 answer
pysmb listpath method return error "SMB connection not authenticated"
I'm using pysmb to connect a server (192.168.1.54) the code are:
host = '192.168.1.54' # server IP
username = 'Test'
password = 'test'
my_name = "localmac"
remote_name = "servermac"
try:
conn =…

user18443702
- 21
- 2
2
votes
2 answers
check if samba directory exist in python3
I have a samba directory smb://172.16.0.10/public_pictures/ and I would like to know if it is accessible.
try something like the following:
import urllib
if open("smb://172.16.0.10/public_pictures/"):
print("accessible")
else:
print("no…

laur
- 500
- 1
- 9
- 23
1
vote
0 answers
pysmb not working on linux ubuntu server 22.04 LTS
I have a telegram bot and there I implemented support for receiving files from a file server, in my case smb. The problem is that on the local everything works fine! You also need to keep in mind that I have Ubuntu 20.04 on my local. This is the…

Abduhamidov Jordan
- 43
- 5
1
vote
1 answer
How to rename nested directories and files recursively using pysmb in python?
Recently, I had to rename all space characters used in the directory and file names in a Samba tree.
Before that, I used os.walk to traverse the directory tree of regular files in python, but I wanted to rename them in-place.
To connect to my Samba…

Ali SHOKOUH ABDI
- 21
- 6
1
vote
1 answer
pysmb from linux to Windows, Unable to connect to shared device
Trying to connect to an smb share via pysmb and getting error...
smb.smb_structs.OperationFailure: Failed to list on \\\\H021BSBD20\\shared_folder: Unable to connect to shared device
The code I am using looks like...
from smb.SMBConnection import…

lampShadesDrifter
- 3,925
- 8
- 40
- 102
1
vote
1 answer
How to use Python SMB connection when you don't know the server's IP?
I'm using PySMB right now:
https://pysmb.readthedocs.io/en/latest/api/smb_SMBConnection.html
and the SMBConnection.connect spec is problematic because it requires knowing the server's IP address.
What about a usage case where I don't know the IP…

user1258361
- 1,133
- 2
- 16
- 25
1
vote
1 answer
How to mock SMBConnection class to return mock connection object
I have a function that returns smb.SMBConnection object.
In my_module.py
from smb.SMBConnection import SMBConnection
def get_connection(user, pwd, server):
return SMBConnection(user, pwd, socket.gethostname(), server, use_ntlm_v2=True)
I am…

Ciasto piekarz
- 7,853
- 18
- 101
- 197
0
votes
0 answers
How to determine if a zip file in the network path is corrupted or not using Python
I have some zip files copied to a network drive. I'm using pysmb to connect to the network drive. I know the testzip() method of the zipfile library can be used to check whether the given zip file is corrupted or not. It works well when I specify a…

Kingston X
- 65
- 5
0
votes
0 answers
Failing to build connection with server folder using SMBConnection
I am trying to connect to a server folder which is only accessible through Wireguard VPN. I installed the VPN, and created the wg-config.conf file and currently, I am able to connect via Finder on my Mac. Here is the access address:…

serdar_bay
- 271
- 1
- 7
0
votes
0 answers
pysmb - reads a file while the file is written by another system
I have a scenario where few external programs/system writes file to shared drive. sometimes users may also copy files to the shared drive.
I have developed a simple python program to read the files continuously from the same shared drive and perform…

Arjun Viswanathan
- 11
- 1
- 5
0
votes
1 answer
Download file from windows shared drive faster
I need to download files from remote shared drive in my local system,
and for that I'm using pysmb library to make a connection.
The code is as follows:
import pysmb
conn = SMBConnection(username, password, client_machine_name, server_name,…

Gary
- 31
- 1
- 6
0
votes
0 answers
How to get the md5 checksum of files present in windows shared folder?
I'm using pysmb to connect to windows shared folder and calculate the md5 checksum of the files
I'm using hashlib for this purpose.
The code I have tried is as follows:
conn = SMBConnection(userName, password, config.clientMachineName, serverName,
…

Gary
- 31
- 1
- 6