Vandheer
30-03-2017, 09:21
Привет. Как передать пароль из модуля pwd в pysmbc. При операции ctx.opendir('smb://IBM').getdents() выдает ошибку smbc.PermissionError: (1, 'Operation not permitted)
import smbc
import pwd
import os
def do_auth (svr, shr, wg, un, pw):
return ('SEVEN.LOCAL', user_info.pw_name , user_info.pw_passwd)
user_info = pwd.getpwnam(pwd.getpwuid(os.getuid()).pw_name)
ctx = smbc.Context(auth_fn=do_auth)
entries = ctx.opendir('smb://IBM').getdents()
for entry in entries:
print (entry.name)
import smbc
import pwd
import os
def do_auth (svr, shr, wg, un, pw):
return ('SEVEN.LOCAL', user_info.pw_name , user_info.pw_passwd)
user_info = pwd.getpwnam(pwd.getpwuid(os.getuid()).pw_name)
ctx = smbc.Context(auth_fn=do_auth)
entries = ctx.opendir('smb://IBM').getdents()
for entry in entries:
print (entry.name)