Linux Mint File Sharing

Connection sharing, Firewall, Samba..etc
Forum rules
Before you post please read how to get help
u00abe1
Level 1
Level 1
Posts: 8
Joined: Wed Mar 12, 2014 5:07 pm

Linux Mint File Sharing

Postby u00abe1 » Sat Mar 22, 2014 4:20 pm

Hello, newbie here. With XP riding into the sunset, I decided to take the plunge and go Linux Mint. I'm running Mint Petra on two laptops, networked together thru a wireless router. One machine runs Linux only, the second is my "old" laptop, dual boot Linux and Win 7. I would like to setup a simple file sharing network between the two laptops, even if it's a single folder on each machine, accessible thru Linux. I've got Samba on both machines, with the GUI. My problem is, I've found so many tutorials online that lead in different directions. I'm all confused. In my mind, this should be fairly simple to setup.

For now, I'm using Dropbox to share files. It works, but I have to upload to the cloud and then download again. I'd prefer to keep files within my network.

I'm very pleased with Mint so far. I've learned a lot over the last few weeks. If I can crack this issue, I'll be in good shape, I think. Thanks in advance.

altair4
Level 18
Level 18
Posts: 8765
Joined: Tue Feb 03, 2009 10:27 am

Re: Linux Mint File Sharing

Postby altair4 » Sat Mar 22, 2014 4:42 pm

I've got Samba on both machines, with the GUI.


I don't know what "with the GUI" means but some samba utilities are actually quite dangerous - like gadmin-samba.

Anyway I will give you the 5 minute samba howto when using 2 linux machines - it's actually much simpler than when you have to deal with Windows:

Open Nemo - your file manager.
Right click your Public folder - it doesn't have to be your public folder but this is just an example.
Select "Sharing Options"
Select all the boxes
Select create share.

You have just created a samba share of your Public folder.

On the other Mint machine open a terminal and type:

Code: Select all

nemo smb://host-name.local/public

Change host-name to the host name of the machine you just created the share on - and don't forget the .local

Unless you've done something to your firewall or if avahi-daemon isn't running Nemo should open up to your share. When it does bookmark it: Bookmark > Create Bookmark.

If you run into any problems:

*** Make sure avahi is running on both machines:

Code: Select all

sudo service avahi-daemon start

*** If you aren't using Cinnamon there is no nemo so please tell us what desktop environment you are using.
*** Since I don't know that "with the GUI" means and since I don't know if you've used it yet you might want to post the output of the following commands so we can see how you are set up:

Code: Select all

testparm -s

Code: Select all

net usershare info --long

Note: I should be back in about 2 hours so if you post something don't think I've abandoned you. :wink:
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

u00abe1
Level 1
Level 1
Posts: 8
Joined: Wed Mar 12, 2014 5:07 pm

Re: Linux Mint File Sharing

Postby u00abe1 » Sat Mar 22, 2014 5:01 pm

GUI - Graphical User Interface - gives me a "window" interface to Samba, rather than having to use the terminal. I'm using Cinnamon desktop on both machines. I'll try what you've suggested and post back.

u00abe1
Level 1
Level 1
Posts: 8
Joined: Wed Mar 12, 2014 5:07 pm

Re: [Solved] Linux Mint File Sharing

Postby u00abe1 » Sat Mar 22, 2014 5:22 pm

The public folder on each machine is now shared and visible on the other machine. Success. Thanks. Now on to the next challenge - setting up access to the USB mass storage on my Droid Razr smartphone.

altair4
Level 18
Level 18
Posts: 8765
Joined: Tue Feb 03, 2009 10:27 am

Re: Linux Mint File Sharing

Postby altair4 » Sat Mar 22, 2014 6:20 pm

Great!

For future reference: If you set this share up as writeable to guests then all files saved to that share by the user on the other machine will save as owned by "nobody" which is a default user in Linux. You won't be able to edit the file as the local user since only "nobody" can do that.

The easiest way around this dilemma is to make the remote guest appear to be you - for that share - by:

Editing smb.conf as root:

Code: Select all

gksu gedit /etc/samba/smb.conf

Add a line right under the Workgroup line under the [global] section of the file:

Code: Select all

force user = your-user-name

Change your-user-name to your actual login user name for that box.

Then restart samba:

Code: Select all

sudo service smbd restart

All future files saved by the client will save with "your-user-name" as owner so everyone will be able to edit the files.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

HilltopsGM
Level 3
Level 3
Posts: 199
Joined: Thu Mar 15, 2012 8:11 pm

Re: Linux Mint File Sharing

Postby HilltopsGM » Sun Apr 06, 2014 2:43 am

Hi altair4,

I have just been wrestling with this myself.

Linux Mint 13 LTS Cinnamon 64bit, Upgraded including the backports to Cinnamon 2.0 on both machines
users/password combo is the same for each user on both machines: admin, Barb, Karen
Barb & Karen are Standard Users

Regarding your posts last solution . . . IF you had more than one user on that machine that is doing the "Sharing" - if I understand this correctly - then that solution would ONLY work for the first user, no?

After much hair pulling, and finding out that if someone were to write a file to the share from another machine, & that the owner of that newly written file becomes nobody, I was wondering if there is a better way to do this?

Regarding this:
Open Nemo - your file manager.
Right click your Public folder - it doesn't have to be your public folder but this is just an example.
Select "Sharing Options"
Select all the boxes
Select create share.


If I DIDN'T select all the boxes
<<specifically: Guest Access (for people without a user account) >>
I am then confronted with a request to Login with a username, Domain, Password challenge that is NEVER accepted when I select "Connect"!
ie: Karen trying to login to Barbs machine while Barb is currently logged on.

I have created an account on both machines for all three of the users.

WHY does that not work?

If they DID authenticate with a username and password, would the file owner then then be the user who provided the authenticating username?

Thanks for the help!

HilltopsGM
Level 3
Level 3
Posts: 199
Joined: Thu Mar 15, 2012 8:11 pm

Re: Linux Mint File Sharing

Postby HilltopsGM » Sun Apr 06, 2014 3:34 am

You got me thinking altair4

If you can "Force a user" to equal something like this:

Code: Select all

force user = your-user-name


Could we not "Force a Group" as well, or Instead of a user?

If so, then All I'd have to do is make sure every user I add to the machine is also a part of that "Global Sharing Group".

I'd still like to figure out why we can't login with the username and password, but for now is this possible?

altair4
Level 18
Level 18
Posts: 8765
Joined: Tue Feb 03, 2009 10:27 am

Re: Linux Mint File Sharing

Postby altair4 » Sun Apr 06, 2014 8:44 am

If I DIDN'T select all the boxes
<<specifically: Guest Access (for people without a user account) >>
I am then confronted with a request to Login with a username, Domain, Password challenge that is NEVER accepted when I select "Connect"!
ie: Karen trying to login to Barbs machine while Barb is currently logged on.

I have created an account on both machines for all three of the users.

WHY does that not work?

Two different user name databases. One is the local login user name and the other is the samba password database. So if Barb want to allow Karen to access the share Barb needs to create the "Karen" account on her machine and then add her to the samba password database:

Code: Select all

sudo smbpasswd -a karen

If they DID authenticate with a username and password, would the file owner then then be the user who provided the authenticating username?

Yes, unless you used "force user = barb" in smb.conf
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

altair4
Level 18
Level 18
Posts: 8765
Joined: Tue Feb 03, 2009 10:27 am

Re: Linux Mint File Sharing

Postby altair4 » Sun Apr 06, 2014 9:48 am

HilltopsGM wrote:If you can "Force a user" to equal something like this:

Code: Select all

force user = your-user-name

Could we not "Force a Group" as well, or Instead of a user?
If so, then All I'd have to do is make sure every user I add to the machine is also a part of that "Global Sharing Group".

This gets tricky. Samba actually interferes with the normal way permissions are set on new files added to the share so you would either:

[1] Have to abandon the nemo share method and create a special share in smb.conf itself:

*** Remove the share you created in nemo
*** Add the following share ( example ) at the end of smb.conf:

Code: Select all

[Public]
path = /home/barb/Public
browseable = yes
guest ok = no
force group = plugdev
writeable = yes
create mask = 0664
force directory mode = 2775

*** Change permissions of the shared folder to set the "setgid" bit so all new files "inherit" the group of the parent:

Code: Select all

sudo chmod 2777 /home/barb/Public

*** Change ownership of the shared folder to that group:

Code: Select all

sudo chown :plugdev -R /home/barb/Public

Then restart smbd.

[2] Or stay with the Nemo method but use bindfs to create a view of the folder that does the same thing:

*** Install bindfs:

Code: Select all

sudo apt-get install bindfs

*** Then create a temporary "view" by running this command:

Code: Select all

sudo bindfs -o perms=0666:+X,group=plugdev /home/barb/Shared /home/barb/Shared

Note: that's the command for Mint13. Later Mint releases specify groups differently.
*** If this is the only share you can add the line ( without sudo ) to /etc/rc.local above the "exit 0" line to have this done automatically at boot.

If you have several of these shares the best thing to do is create your own upstart job as explained here: viewtopic.php?f=42&t=69834#p465117
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

HilltopsGM
Level 3
Level 3
Posts: 199
Joined: Thu Mar 15, 2012 8:11 pm

Re: Linux Mint File Sharing

Postby HilltopsGM » Sun Apr 06, 2014 3:29 pm

Awesome replies altair4! Thanks


altair4 wrote:.... So if Barb want to allow Karen to access the share Barb needs to create the "Karen" account on her machine


I the part I missed was

altair4 wrote:....and then add her to the samba password database:

Code: Select all

sudo smbpasswd -a karen




Regarding this:

HilltopsGM wrote:If they DID authenticate with a username and password, would the file owner then then be the user who provided the authenticating username?

& the reply

altair4 wrote:Yes, unless you used "force user = barb" in smb.conf


If we were to "Force user", If Karen created a file on the share, and Barbs system force the user to be "Barb", Karen should still be able to edit the file, no?
I would think so as she wouldn't have been able to create it to begin with if we didn't have the permissions set properly.

Just wanted to bounce that off of you again.

Thanks

HilltopsGM
Level 3
Level 3
Posts: 199
Joined: Thu Mar 15, 2012 8:11 pm

Re: Linux Mint File Sharing

Postby HilltopsGM » Sun Apr 06, 2014 3:36 pm

Is there a way in which we could create a share in which a 'guest' just has to enter a PASSWORD only?

Then we would not have to create a user account on EVERY machine that is sharing for EVERY person that might be connecting.

It would keep it private from "Casual Browsing", and with the "force user = ....." option, the current owner of the share would still be able to edit the file etc, etc.

comments?

Thanks again.

altair4
Level 18
Level 18
Posts: 8765
Joined: Tue Feb 03, 2009 10:27 am

Re: Linux Mint File Sharing

Postby altair4 » Sun Apr 06, 2014 3:38 pm

If we were to "Force user", If Karen created a file on the share, and Barbs system force the user to be "Barb", Karen should still be able to edit the file, no?

Yes. After karen passes the correct credentials her identity changes from karen to barb so everything she does at that point is as barb - within the constraints of that share of course.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

altair4
Level 18
Level 18
Posts: 8765
Joined: Tue Feb 03, 2009 10:27 am

Re: Linux Mint File Sharing

Postby altair4 » Sun Apr 06, 2014 3:49 pm

HilltopsGM wrote:Is there a way in which we could create a share in which a 'guest' just has to enter a PASSWORD only?

Then we would not have to create a user account on EVERY machine that is sharing for EVERY person that might be connecting.

It would keep it private from "Casual Browsing", and with the "force user = ....." option, the current owner of the share would still be able to edit the file etc, etc.

comments?

Thanks again.

That's share level security and once upon a time samba allowed such a thing but it's considered deprecated these days. It still works but not for long. In the next 30 days Ubuntu 14.04 will be released ( and then Mint17 ) and with it Samba4 which finally removes it as an option altogether.

What I would suggest is one step removed from that. Just create one user: smbuser and add it to smbpasswd. Everyone will use the exact same user name and password instead of multiple ones. The "force user" will then convert smbuser to barb or whoever.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

HilltopsGM
Level 3
Level 3
Posts: 199
Joined: Thu Mar 15, 2012 8:11 pm

Re: Linux Mint File Sharing

Postby HilltopsGM » Sun Apr 06, 2014 6:56 pm

altair4 wrote:What I would suggest is one step removed from that. Just create one user: smbuser and add it to smbpasswd. Everyone will use the exact same user name and password instead of multiple ones. The "force user" will then convert smbuser to barb or whoever.


Genius!
Great idea altair4.
Thanks so much for the help. :D

derrwood
Level 1
Level 1
Posts: 2
Joined: Mon Apr 07, 2014 1:37 pm

Re: Linux Mint File Sharing

Postby derrwood » Mon Apr 07, 2014 2:27 pm

Hello there

I've been having some issues too. Your help would be greatly appreciated.

The set up: 2 machines both with Linux Mint 16 linked by a wireless router. The first machine called "office" has multiple users and a hard drive stuffed with music, movies and photos. The second machine called "livingroom" has a single account and is intended as a machine that can play said music, movies and photos on our main tv to which this pc is attached.

The work so far: I've enabled folder sharing via nemo and via your guide above. When I log into the "livingroom" machine, start nemo and click on network, then office I can see the shared folders.

The problem: When I open any of the shared folders I can see all the files but cannot play the music or videos or view the images.

The clue: I tried opening a video using VLC and got the following error:

File reading failed:
VLC could not open the file
"/run/user/1000/gvfs/smb-share:server=office,share=videos/Movie/A
Charlie Brown Christmas (1965)/A Charlie Brown Christmas.avi".
(Permission denied)
Your input can't be opened:
VLC is unable to open the MRL
'file:///run/user/1000/gvfs/smb-share%3Aserver%3Doffice%2Cshare%3Dvideos/Movie/A%20Charlie%20Brown%20Christmas%20%281965%29/A%20Charlie%20Brown%20Christmas.avi'.
Check the log for details.

The plea: So it looks like a permissions problem. I scoured the forums but most solutions refer to linux to windows issues which, as was mentioned in an earlier post, is more complicated than this.

So a small push in the right direction would be appreciated.

Cheers

altair4
Level 18
Level 18
Posts: 8765
Joined: Tue Feb 03, 2009 10:27 am

Re: Linux Mint File Sharing

Postby altair4 » Tue Apr 08, 2014 7:32 am

I'm not all that familiar with VLC but some applications play well with gvfs and others don't.

Create a real mount point for the share:

Code: Select all

sudo mkdir -p /mnt/Samba/Office-Videos

Then temporarily mount the share:

Code: Select all

sudo mount -t cifs //office/videos /mnt/Samba/Office-Videos -o guest,uid=1000,iocharset=utf8,nounix

EDIT: Or, if the share requires credentials:

Code: Select all

sudo mount -t cifs //office/videos /mnt/Samba/Office-Videos -o username=some-user-name,password=some-password,uid=1000,iocharset=utf8,nounix

Then see if VLC has any issues with the file at /mnt/Samba/Office-Videos/Movie/A Charlie Brown Christmas (1965)/A Charlie Brown Christmas.avi".

If it doesn't then I would suggest AutoFS to mount these shares if they are shares you mount often.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

hotapp
Level 1
Level 1
Posts: 1
Joined: Tue Apr 08, 2014 9:19 am

Re: Linux Mint File Sharing

Postby hotapp » Tue Apr 08, 2014 9:32 am

I followed this post, but can't seem to find an answer to my issue. I have a small network of 4 users (all WIN7 desktops). I have loaded a 5th PC with Mint 16 to be used as a network file server. I have set up rcp and have been successful in accessing and controlling the LinuxMint remotely. I created a Mint folder called "DATA" and was able to share it with the WIN7 PCs. I set up the shared folder as a network device on the WIN7 pcs to provide easy access.

My issue is the the DATA sharing. It does not stick! If the linux box is restarted, the sharing has to be re-established. This won't happen that often, but is there some command line voodoo that will let the OS remember my preferences?

altair4
Level 18
Level 18
Posts: 8765
Joined: Tue Feb 03, 2009 10:27 am

Re: Linux Mint File Sharing

Postby altair4 » Tue Apr 08, 2014 6:01 pm

@hotapp, anything is possible I suppose but the actual sharing of a directory is not something that vanishes with a reboot.

Take a look at the output of the following commands:

Code: Select all

testparm -s

Code: Select all

net usershare info --long

The DATA share definition should be in the output of at least one of those commands.

What may be happening is the share is still there but the data folder is not because it's not mounted yet. If the folder being shared is on a non-system partition and you are not mounting it at boot then there is nothing to share until you mount it.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

Cammo
Level 2
Level 2
Posts: 59
Joined: Tue Apr 08, 2014 8:19 pm

Re: Linux Mint File Sharing

Postby Cammo » Fri Apr 11, 2014 8:25 am

some samba utilities are actually quite dangerous - like gadmin-samba


Sorry if this is noobish Altair, but how/why is gadmin-samba dangerous?

altair4
Level 18
Level 18
Posts: 8765
Joined: Tue Feb 03, 2009 10:27 am

Re: Linux Mint File Sharing

Postby altair4 » Fri Apr 11, 2014 9:00 am

Because it doesn't edit the default smb.conf it replaces it with its own. And the one it replaces it with may have been very up to date back when it was written but it's out of place in a modern desktop / home lan environment.

It creates an incomprehensible incoherent mess that is unsupportable in most forums. It doesn't seem to understand the nature of what smb.conf is supposed to be. Despite it's name smb.conf is NOT the samba configuration file. It's a file set up to add to or override the samba default settings already enabled by default.

It may be difficult for some to believe but someone ( in this case Samba itself, Debian, and then Ubuntu ) have actually given the default settings some thought. It may need some minor tweaking to accommodate a home lan environment but the wholesale destruction of smb.conf that gadmin-samba does is just unwarranted.

The vast majority of threads I've been involved in where resolved merely by bringing back smb.conf to it's default state and perhaps making one or two edits. One could argue that gadmin-samba may be a useful tool in the hands of a professional systems administrator who knows what to do and not do but why that professional is using a utility to do this is beyond me.

If the average home user wants to create shares and doesn't want to use the bult in method in Nemo, Caja, or Nautilus then I would suggest something less destructive like system-config-samba or just add shares directly to smb.conf itself.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.


Return to “Other networking topics”

Who is online

Users browsing this forum: No registered users and 2 guests