create a directory on /etc/samba/ via python

  Kiến thức lập trình

I am trying to create a directory on /etc/samba/ but I have the error:
PermissionError: [Errno 13] Permission denied: '/etc/samba/credentials'

My function is this:

samba_credentials_path = "/etc/samba/credentials"

# Funcion para crear el archivo de credenciales
def create_credentials_file(user, password, domain):
    try:
        os.makedirs(samba_credentials_path, 0o700, exist_ok=True)
    except FileExistsError:
        print("El directorio ya existe :D")

New contributor

Andres is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

3

LEAVE A COMMENT