I ran into what seems to be a common issue with Nextcloud: when adding an SMB share, it fails as soon as you enter the password to confirm the connection. I’m in a Yunohost environment, but the general idea should apply to a standard environment. It’s extremely frustrating — but fortunately, you can fix it by SSHing into the server and running a few commands.
Below is a clean, concise guide.
Required Variables
Before running the commands, gather the following:
- new_share_name – The name of the share as it will appear in Nextcloud
- host – IP address of the SMB server (example:
192.168.1.100) - share – Name of the SMB share (example:
sambashare) - root – Root directory on the share (use
""for root) - user – SMB username
- password – SMB user password
- mount_id – The mount ID returned after creating the share (example:
30) - usernames – One or more Nextcloud usernames to grant access (comma-separated for multiple users)
Instructions
1. Enter the Yunohost Nextcloud Shell
Open your terminal and run:
yunohost app shell nextcloud
2. Create the SMB Mount
Replace the variables with your actual values:
php occ files_external:create "new_share_name" smb password::password --config host="host" --config share="share" --config root="root" --config user="user" --config password="password"
3. Note the Mount ID
After running the command, Nextcloud will output the mount ID (a number such as 30).
You’ll need this for assigning the share to specific users.
4. Apply the SMB Mount to Users
Remove default access and assign the mount to selected users:
php occ files_external:applicable mount_id --remove-all php occ files_external:applicable mount_id --add-user="username1, username2"
5. Verify the Configuration
php occ files_external:list
6. Exit the Shell
exit
Final Thoughts
This solved the SMB password confirmation issue for me. I couldn’t find a clear, consolidated guide anywhere — so hopefully this helps someone avoid the same frustration!




