Module: shares

This module is used to deal with mounting and unmounting samba shares.

Members

linuxmusterLinuxclient7.shares.getLocalSysvolPath()[source]

Get the local mountpoint of the sysvol

Returns

Full path of the mountpoint

Return type

str

linuxmusterLinuxclient7.shares.getMountpointOfRemotePath(remoteFilePath, hiddenShare=False, username=None, autoMount=True)[source]

Get the local path of a remote samba share path. This function automatically checks if the shares is already mounted. It optionally automatically mounts the top path of the remote share: If the remote path is //server/sysvol/linuxmuster.lan/Policies it mounts //server/sysvol

Parameters
  • remoteFilePath (str) – Remote path

  • hiddenShare (bool) – If the share sould be visible in Nautilus

  • username (str) – The user in whoms context the share should be mounted

Parama autoMount

If the share should be mouted automatically if it is not already mounted

Returns

Tuple: (success, mountpoint)

Return type

tuple

linuxmusterLinuxclient7.shares.mountShare(networkPath, shareName=None, hiddenShare=False, username=None)[source]

Mount a given path of a samba share

Parameters
  • networkPath (str) – Network path of the share

  • shareName (str) – The name of the share (name of the folder the share is being mounted to)

  • hiddenShare (bool) – If the share sould be visible in Nautilus

  • username (str) – The user in whoms context the share should be mounted

Returns

Tuple: (success, mountpoint)

Return type

tuple

linuxmusterLinuxclient7.shares.unmountAllSharesOfUser(username)[source]

Unmount all shares of a given user and safely delete the mountpoints and the parent directory.

Parameters

username (str) – The username of the user

Returns

True or False

Return type

bool