Ubuntu – How to set up an entire hard drive as a shared drive in Samba

hard drivesambaserver

I am trying to set an entire hard drive as a share using Samba on our server running Ubuntu Desktop 16.04. I have been able to successfully set up a shared folder, but I am having problems setting up the drive.

Here is what I have in the smb.conf file, where [share] is the shared folder and [share2] is what I have set for the hard drive:

[share]
path = /home/craig/desktop/share
available = yes
valid users = craig-pc
read only = no
browsable = yes
public = yes
writable = yes

[share2]
path = /media/craig/Seagate D1
available = yes
valid users = craig-pc
read only = no
browsable = yes
public = yes
writable = yes

Another question I have is on the valid users statement, currently I have it set for only my windows 7 pc which is user craig-pc, when I wish to add additional users do I add them in the same line using a comma like valid users = craig-pc, bob-pc, etc.? What is the correct method of adding additional valid users?

I deleted the Share2 info from my smb.conf file and then set up the hard drive as a share using the Samba GUI (system-config-samba), what follows is the information it placed in the smb.conf file for the share:

[Seagate D1]
path = /media/craig/Seagate D1
writeable = yes
valid users = craig-pc, craig, marcy  

PLEASE NOTE: the path does not have the quotation marks around it because of spaces in it, so I am not sure if they are needed as suggested it should have by Terrance (BTW – Thank you for your comment).

Best Answer

Okay I solved this problem myself.

In order to share an entire hard drive this is all that is necessary to do.

Step 1

Add the following share text to /etc/samba/smb.conf.

[HardDrive]  
path = /media/craig/Seagate D1  
writeable = yes  
valid users = craig-pc, craig, marcy  
  • Note: you must change the path to the actual path of your hard drive, and add the actual users that you wish to have access to the drive. The users must have valid user accounts.

  • Also please note that it is not necessary to put quotation marks around the path because of the space between the word Seagate and D1.

Step 2

Open the Ubuntu Nautilus file browser and right-click on the hard drive you want to share.

Select Properties from the menu, and click on the Local Network Share tab.

Select Share This Folder, and Allow Others to Create and Delete files in this folder.

Click Modify Share.

That's it!

You have now shared the entire hard drive.

Related Question