Python SMB Connection
-
Hey Guys,
I have a Problem and i don't find my solution...
Here's my test Code:import smb from smb.SMBConnection import SMBConnection from nmb.NetBIOS import NetBIOS netbios = NetBIOS() share_name = "share" user_name = "user" password = "passwd" server_IP = "xxx.xxx.xxx.251" local_machine_name = socket.gethostname() server_machine_name = netbios.queryIPForName(server_IP) print(server_machine_name[0]) # create and establish connection conn = SMBConnection(user_name, password, local_machine_name, server_machine_name[0], domain="WORKGROUP", use_ntlm_v2=True) # 139 # 445 print(conn.connect(server_IP, 445))
i get every Time this Message:
ELEKTROTECHNIK False
but the Function
conn.connect
return on Success True... not False....
i Have no idea what i'm doing wrong...im trying to connect to my Synology NAS 718
i hope you guys know what im doing wrong....
Thanks!!
-
@DavinE smb is not a standard module of Pythonista, in site-packages, thus you could try to install there the same as on your Raspberry.
-
@cvp
smb is in the module of pysmb or ?
on my iPad an my Pi the version is the same.... 1.2.6
and i installed both withpip install pysmb
-
last edited by
-
I have the same problem on another WD NAS....
-
@cvp said:
@DavinE said:
smb is in the module of pysmb
Yes
okay... then i have no idea what and how i solve my what ever ^^....
-
last edited by
-
last edited by
-
@cvp said:
@DavinE said:
okay for test now ?
Test what?
The Connection or do you have this problem longer ?
-
@DavinE I normally access this NAS via FTP but I just tested it with your script and I meet the same connection error.
-
last edited by
-
@cvp said:
@DavinE I normally access this NAS via FTP but I just tested it with your script and I meet the same connection error.
hehe okay and my idea is now FTP ^^
works this with Pythonista ?
-
@DavinE FTP is ok and SFTP (SSH) also
-
But my old WD NAS does not support SFTP...
-
from ftplib import FTP import paramiko
ftplib for FTP
paramiko for SFTP
-
@cvp said:
from ftplib import FTP import paramiko
ftplib for FTP
paramiko for SFTPI know I'm annoying you a lot, but would you have a script like with SMB?
-
@cvp said:
@DavinE FTP is ok and SFTP (SSH) also
SFTP i don't know it works because i use Private Key's for my SSH connection...
-
@DavinE upload or download?
-
last edited by
-
@DavinE try first this
from ftplib import FTP ip = '192.168.0.47' user = 'admin' pwd = 'xxxxxxx'' ftp = FTP(ip) #connect ftp.encoding = 'utf-8' ftp.login(user,pwd) ftp.retrlines('NLST *') ftp.quit()
-
Upload
ftp = FTP(ip) #connect ftp.encoding = 'utf-8' ftp.login(user,pwd) local_file = open(path,'rb') ftp.storbinary('STOR '+server_file, local_file, blocksize=32768) local_file.close() ftp.quit()