How do I stop the amnesia occuring when reconnecting to my NAS?

This has been bugging me for a while.

Basically whenever I reboot and then try to access my NAS, the credentials are temporarily forgotten and I get prompted to enter a password, but I have to click cancel and then manually specify the username and password.

The setting “remember” has no effect, so why it even is an option is beyond me. This should just work.
And yes the credentials are stored so there is no logical reason for this issue.

Any help to resolve it would be greatly appreciated.

Hello @DragonFox :wink:

There are 2 optional dependencies for thunar:

  • libgnome-keyring
  • libsecret

Check if theses ones are installed. gnome-keyring is there for storing passwords.

while libgnome-keyring wasn’t present, installing it had no effect after a reboot.

Is gnome-keyring running?

ps -aux | grep keyring

Can you install and run seahorse?

I currently see 3 instances of gnome-keyring
And seahorse (I had forgotten it’s name) I have looked at before and the credentials are indeed there. (And there is no spelling mistakes or such)

Generally my experience with inbuild SMB shares in file managers have been bad across the board.

Thats why I mount my share via fstab.

Sorry if the following is not what you wanted, but thats my personal experience.

Here a quick run down how I do it

  1. Create a folder where you want to mount your share, personally I do it under /mnt/NAS, but it can also be in your home folder
  2. Create a .smbcredentials file in your home directory, put the following in it:
username=your_user
password=your_password
  1. Restrict access to that file in your home directory: chmod 600 .smbcredentials
  2. Edit /etc/fstab in your preferred text editor with root permissions and add the following:
//192.168.x.xxx/NAS         /mnt/NAS      cifs     defaults,uid=1000,credentials=/home/<user>/.smbcredentials,_netdev 0 0
  1. Mount it with sudo mount -a
2 Likes

Well, I’m not getting much luck with that.

//192.168.1.32/X-Shard         "/mnt/X-Shard\040on\040NAS326"      cifs     defaults,uid=1000,credentials=/home/<user>/.smbcredentials,_netdev 0 0
//192.168.1.32/photo         "/mnt/Pictures\040on\040NAS326"      cifs     defaults,uid=1000,credentials=/home/<user>/.smbcredentials,_netdev 0 0
//192.168.1.32/music         "/mnt/Music\040on\040NAS326"      cifs     defaults,uid=1000,credentials=/home/<user>/.smbcredentials,_netdev 0 0
//192.168.1.32/video         "/mnt/Videos\040on\040NAS326"      cifs     defaults,uid=1000,credentials=/home/<user>/.smbcredentials,_netdev 0 0

Couldn’t chdir to “/mnt/X-Shard on NAS326”: No such file or directory
Couldn’t chdir to “/mnt/Pictures on NAS326”: No such file or directory
Couldn’t chdir to “/mnt/Music on NAS326”: No such file or directory
Couldn’t chdir to “/mnt/Videos on NAS326”: No such file or directory

Did you make those folders as described in 1. from my post?

Example:
sudo mkdir "/mnt/X-Shard on NAS326"

Below examples are copy/paste from my functional network. I have Samba shares on a Synology NAS and a Samba share on a system running Manjaro.

Create a file with your credentials as e.g.

/etc/samba/credentials/smb.cred

username=
password=

Mount unit in /etc/systemd/system/a-nas-xshard.mount

Do not use dashes (-) in your mountpoint path as dashes is used by systemd to denote path separator (/).

[Unit]
Description=X-Shard share on NAS

[Mount]
What=//192.168.1.32/X-Shard
Where=/a/nas/xshard
Type=cifs
Options=_netdev,iocharset=utf8,rw,file_mode=0777,dir_mode=0777,credentials=/etc/samba/credentials/smb.cred,vers=2
TimeoutSec=30

[Install]
WantedBy=multi-user.target
sudo systemctl  start a-nas-xshard.mount

The mount point is created (root read/write) if it does not exist. You need to set the permissions for the mountpoint to allow write for other users than root. Permissions to read write to a share is set on the client not the server (unless you are running a complicated active directory setup) - samba only case about access/no access - in case of access read-write or read-only.

sudo chmod ugo+rw /a/nas/xshard

Verify the content of the mountpoint.

ls /a/nas/xshard

If you are sure the NAS is always available and the computer never leaves the network - you can enable the mount unit to be executed at start.

If hovwer - your nas is not available on boot e.g. a laptop which may be away from home - you should not enable the mount unit.

Instead you create a unit to activate your mount unit when you access the mountpoint.

This unit type is called an automount unit.

Automount unit /etc/systemd/system/a-nas-xshard.automount

[Unit]
Description=X-Shard share on NAS

[Automount]
Where=/a/nas/xshard
TimeoutIdleSec=20

[Install]
WantedBy=multi-user.target

Then ensure the mount unit is disabled (automount will fail if mount is enabled) - and enable/start the automount unit.

sudo systemctl disable --now a-nas-xshard.mount
sudo systemctl enable --now a-nas-xshard.automount

yes. they’re all present

Try without spaces in the path names. Just to rule something out.

that I have tried and I get the same error.

And you removed the double-quotes from the entries?

No but that was part of the problem. I had also read <user> as a reference to the current user rather than a placeholder.

Things work as they should now, thanks!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.