This question has been asked several times, but reading the different answers did not get me to resolve my specific problem. Ubuntu 14.04 is installed on my HTPC. I want to share over the LAN the entire content of 2 hard drives via 1 account in read and write. I need to access those shares from Android, mac os x and Windows 10. I was able to create 1 shared folder via Samba, but I cannot write to it. Authentication and read works.

I ran out of ideas to explain why it does not work, and I request the community for help.

Account that must have access: miguel. It is an admin account and I have created a different samba password for it. Shared drive: bigstock


# /boot/efi was on /dev/sda1 during installation
UUID=C2C2-B220  /boot/efi       vfat    defaults        0       1
# swap was on /dev/sda3 during installation
UUID=d20a7536-efe1-4ad4-b8a1-e36c9c5d7bc4 none            swap    sw              0       0
#bigstock drive
UUID=479a5442-ef4e-4266-a729-f1c188755ac7 /media/miguel/bigstock ext4 defaults 0 2
#stock drive
UUID=a0bdc1df-a568-4d26-82bb-cfd35aa3ab32 /media/miguel/stock ext4 defaults 0 2

ls -la /media

total 12
drwxr-xr-x   3 miguel miguel 4096 oct.  22 20:42 .
drwxr-xr-x  23 root   root   4096 déc.   6 11:58 ..
drwxr-xr-x+  4 miguel miguel 4096 nov.   7 17:43 miguel

ls -la /media/miguel

total 16
drwxr-xr-x+  4 miguel miguel 4096 nov.   7 17:43 .
drwxr-xr-x   3 miguel miguel 4096 oct.  22 20:42 ..
drwxr-xr-x  14 miguel miguel 4096 déc.   6 15:04 bigstock
drwxr-xr-x   4 miguel miguel 4096 nov.  26 12:40 stock

ls -la /media/miguel/bigstock

total 68
drwxr-xr-x  14 miguel miguel  4096 déc.   6 15:04 .
drwxr-xr-x+  4 miguel miguel  4096 nov.   7 17:43 ..

testparm -s

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[bigstock]"
Loaded services file OK.
    server string = %h server (Samba, Ubuntu)
    server role = standalone server
    map to guest = Bad User
    obey pam restrictions = Yes
    pam password change = Yes
    passwd program = /usr/bin/passwd %u
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    unix password sync = Yes
    syslog = 0
    log file = /var/log/samba/log.%m
    max log size = 1000
    dns proxy = No
    usershare allow guests = Yes
    panic action = /usr/share/samba/panic-action %d
    idmap config * : backend = tdb

    path = /media/miguel/bigstock
    valid users = miguel
    read only = No

i have tried several other smb option like the 2 masks to 0700 but they had no effect.

1 Answer 1


Looks like you created a folder miguel in the media and you have taken ownership of it. Instead, let's create a group, add users to that group, and set the permissions.

sudo groupadd -g 10000 [samba_group]
sudo adduser migeul [samba_group]
sudo chown root:[samba_group] -R /media/migeul
sudo chgrp [samba_group] /media/migeul
sudo chmod 775 -R /media/migeul

This will create a group and attach it to the folder to be shared. You add the users to that group for access. Set the permissions to 775 which gives the owner and the group read-write-execute access while others only read. Set's it recursively.

Verify that you have total access to the folder. With samba, setting the permissions are a little bit different than file permissions with a ubuntu user. What I mean is that verify the permissions after you take ownership because they could result in a samba error later on down the road. Where nobody can access the drive.

Create a samba account that matches your Linux username precisely.

sudo smbpasswd -a miguel
sudo smbpasswd -e migeul

That will prompt you to create a password for the username miguel. Please note that this is only for SMB shares not for the user in the Operating System.

Afterward, open up the samba config and when sharing the drive make sure you type in writable = yes, browsable = yes, read only = no and add your group to it as well. Also, verify the location you are sharing from. Use the place that it is mounted to.

comment = Migeuls folder
​path = /media/migeul
​browsable = yes
​writable = yes
​guest ok = no
​read only = no
​valid users = @[samba_group]

After you reconfig the /etc/samba/smb.conf file, reload it.

sudo smbd reload

These pages go more in-depth with setting up samba shares.

https://help.ubuntu.com/community/Samba/SambaServerGuide https://www.techrepublic.com/article/how-to-set-up-samba-shares-for-groups/

You may also need to set your umask as well. To do that open up /etc/profile using sudo nano /etc/profile and at the bottom type in umask 002. Use Control+O to save and Control+X to exit. Best to reboot the server using sudo reboot and the new mask permissions will take place. That setting re-asserts the same permissions for the users.

  • 1
    I can't believe this is the accepted answer. Please don't follow this answer. Don't make a device owned by a regular user and set it world writable Feb 1, 2020 at 1:26
  • 1
    You are correct. At the time, that was my working method, however, that was insecure and I had no clue about security. I have fixed the answer to be more secure and to match present-day samba configurations. Feb 1, 2020 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.