SFTP User

class AzuracastPy.models.SFTPUser(id: int, username: str, password: str, publicKeys: str, links: Links, _station)

Represents an SFTP User on a station.

__init__(id: int, username: str, password: str, publicKeys: str, links: Links, _station)

Initializes a SFTPUser object.

Note

This class should not be initialized directly. Instead, obtain an instance via: create(), __call__() or sftp_users().

delete()

Deletes the SFTP user from the station.

Sets all attributes of the current SFTPUser object to None.

Usage:

sftp_user.delete()
edit(username: str | None = None, public_keys: List[str] | None = None)

Edits the SFTP user’s properties.

Updates all edited attributes of the current SFTPUser object.

Parameters:
  • username – (Optional) The new username of the SFTP user. Default: None.

  • public_keys

    (Optional) The new list of public keys to be assigned to the user. Default: None.

    Warning

    This will overwrite the user’s existing keys. Use the add() and remove() methods to interact with the user’s existing keys.

Usage:

sftp_user.edit(
    username="New username",
    public_keys=["alicia", "keys"]
)
key

An instance of PublicKeysHelper.

Provides the interface for working with this SFTP user’s public keys.

For example, to assign one or more public keys to this user:

sftp_user.key.add("key")

sftp_user.key.add("key1", "key2")

To remove one or more keys from this user:

sftp_user.key.remove("key")

sftp_user.key.remove("key1", "key2")
update_password(password: str)

Updates the SFTP user’s password.

Parameters:

password – The SFTP user’s new password.

Usage:

sftp_user.update_password(
    password="new password"
)