Skip to content

Instantly share code, notes, and snippets.

@motleytech
Created June 25, 2016 05:29
Show Gist options
  • Save motleytech/283129bfbe17184120bf84d30b493a3d to your computer and use it in GitHub Desktop.
Save motleytech/283129bfbe17184120bf84d30b493a3d to your computer and use it in GitHub Desktop.
access ubuntu samba share

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment