Often, my work involves sharing a folder in my Ubuntu vm to access it from the host machine, and every once in a while, samba refuses to play ball (Samba is the one who is in charge of sharing folders).
Here is how to fix the problem. After enabling the share in the folder properties (keeping guest access off), we will have to give explicit permissions for a user to access the shared folder.
Suppose your username on ubuntu is testuser
. Type the following commands to give access to the test user...
$ useradd -N -M -g sambashare testuser
$ smbpasswd -a testuser
New SMB password:
Retype new SMB password:
Added user testuser.
$ id testuser
uid=1001(testuser) gid=109(sambashare) groups=109(sambashare)
Now, the user testuser
should be able to access the shares (assuming that the folder being shared gives access to test). It is also advisable to keep your samba password and system password different.