I am using a command similar to the following to mount some NAS samba shares in my Kubuntu 18.04 system:
sudo mount -t cifs -o "username=MyUser" //MyServer/MyFolder ~/SharedFolders/MyFolder
This works fine. However it asks for the password every time. I would like to use the KDE password wallet (or some similar agent) for authentication.
I want the password being asked at the GUI a single time, then it should be stored permanently and reused for future mount
calls.
Is something like that possible with mount
?
If not, is there an automatable alternative in KDE?
Best Answer
There is no way to tell
mount
which program to use for storing/reading passwords, but there are a few KDE tools you can combine to automate the process.For storing/reading passwords:
kwalletcli
For a GUI password prompt:
kdialog
You should be able to install them with your package manager.
I wrote a script that does this (with a few extra options). It should be doing everything you asked for: if the password does not exist, a GUI prompt is shown (if available) and the password is stored in a wallet for later use.
You can update the password from the command line with
kwalletcli
again, but the only way I could find to delete them is the KWalletManager GUI app.Here's the script as of 2020-08-22: