How To - Simple File Sharing in Mint

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Carpintonto
Level 1
Level 1
Posts: 23
Joined: Tue Jun 30, 2009 7:44 pm
Location: Kellogg Idaho

Re: Simple File Sharing in Mint

Post by Carpintonto »

altair4 wrote: You know, no matter how hard I try I can't seem to be as clear and eloquent as Fred :lol: I'm sure he has a posting somewhere that explains this far better than I just did. :wink:
Fred really can break it down, but this worked for me and I have been chasing all through a bunch of Ubuntu forums to end up back where I belong!

good job, thanks again
eric49a

Re: Simple File Sharing in Mint

Post by eric49a »

ok i got samba to share my files with one of my xp comps but not the other one. the one that it is sharing with is connected to the Internet. but the other xp comp is connected to my mint comp via a switch and its not connected to the Internet. So i dono how to get samba to work with the switch I've got. if any one could help that would be nice
altair4
Level 20
Level 20
Posts: 11419
Joined: Tue Feb 03, 2009 10:27 am

Re: Simple File Sharing in Mint

Post by altair4 »

eric49a,

You might want to post a separate topic since this seems less a samba issue and more a network issue. Especially since I don't know what you mean by the term "switch". The two machines that can connect to shares appear to go through the same router but the machine that doesn't is connected to a "switch" - the other end of which is connected to what exactly.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 20
Level 20
Posts: 11419
Joined: Tue Feb 03, 2009 10:27 am

Re: How To - Simple File Sharing in Mint

Post by altair4 »

For those of you that have installed Mint Debian you have probably noticed that Nautilus-share does not work. There are a few more steps required:

Linux Mint Debian Edition Preliminary Steps

Step 1: "Guest Access" option is disabled by default. To enable it:

Open smb.conf as root:

Code: Select all

gksu gedit /etc/samba/smb.conf
Add the following lines to the [global] section - right under the workgroup line:

Code: Select all

usershare allow guests = yes

Code: Select all

map to guest = Bad user
And restart samba:

Code: Select all

sudo service samba restart
Step 2: You do not have permissions to create a usershare because you are not included in the correct group.

Code: Select all

sudo gpasswd -a your_user_name sambashare
Step 3: Add samba client packages

Code: Select all

sudo apt-get install gvfs-fuse
sudo apt-get install libsmbclient
sudo apt-get install smbclient
sudo apt-get install python-smbc
Then add yourself to the fuse group:

Code: Select all

sudo gpasswd -a your-user-name fuse
Step 4: Logoff and Login again for all the group changes to take affect

There is one more thing I need to tell you. After you select the "Create Share" button nautilus abruptly closes and for a very brief moment your entire desktop will disappear. Fear not - it will return. I have no earthy idea what's going on there but there's probably a Debian bug report somewhere that I will try and find to see if there is a workaround or fix.
Last edited by altair4 on Sun Aug 25, 2013 2:52 pm, edited 7 times in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
AbeFreeman

Re: How To - Simple File Sharing in Mint

Post by AbeFreeman »

I've got / and /swap set up as ext4, and then 2 NTFS partitions that I keep my data on. I shared the folders, with guest access, as per your instructions, but the other user (kids) on this machine can't even see the ntfs partitions in the file browser. I thought it might me related to the problem Ivleph was having with a virtualbox trying to access the partitions, but when I tried to edit /etc/fstab, the ntfs partitions weren't even listed. Just / and /swap. I've already mounted them. What else do I need to do to make them available?


[2nd question] I also want the kids account to by default access all the same data files that the main user does for certain programs (like Anki, since they already made a bunch of flashcard decks using the main user's account). I don't mind if I make all data available, just so long as they don't have the power to delete stuff. How do I do this?
altair4
Level 20
Level 20
Posts: 11419
Joined: Tue Feb 03, 2009 10:27 am

Re: How To - Simple File Sharing in Mint

Post by altair4 »

but when I tried to edit /etc/fstab, the ntfs partitions weren't even listed. Just / and /swap. I've already mounted them. What else do I need to do to make them available?
You mounted them through Nautilus I assume. If so then they will mount with owner = You and with permissions set at 700 meaning "You" will have read write access and no one else. One way to fix this is to have them automount in fstab. Another way is to do the following:
Edit smb.conf as root:

Code: Select all

gksu gedit /etc/samba/smb.conf
Add the following line to the [global] section of smb.conf:

Code: Select all

force user = you
Change "you" to your own login user name
Save the file, exit gedit, and back in the terminal restart samba:

Code: Select all

sudo service smbd restart
I don't mind if I make all data available, just so long as they don't have the power to delete stuff. How do I do this?
Make the share read only. Go back into Nautilus > Sharing Options and uncheck "Allow other people to write in this folder"
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
sangre1077

Re: How To - Simple File Sharing in Mint

Post by sangre1077 »

Man i've been trying to get file and print sharing on my linux mint 9 isodora edition can't seem to figure it out some commands aren't working i think i'm some how using both nautilus and samba that might be the reason...

I looked at my smb.conf file and i dont have a global section either.


$ sudo service samba restart
samba: unrecognized service
sarge@sarge-desktop ~ $
that commands says that everytime

Code: Select all

  #############################################################
    # Simple Generic Samba configuration file
    #
    # Written by Mike Tatum for the Linux Mint Forum.
    # 20th May 2008
    # Use at your own peril!
    ###############################################################
    # This is the main Samba configuration file. You should read the
    # smb.conf(5) manual page in order to understand the options listed
    # here. Samba has a huge number of configurable options most of which
    # are not shown in this example
    #
    # Any line which starts with a ; (semi-colon) or a # (hash)
    # is a comment and is ignored. In this example we will use a #
    # for commentary and a ; for parts of the config file that you
    # may wish to enable
    #
    # NOTE: Whenever you modify this file you should run the command
    # "testparm" to check that you have not made any basic syntactic
    # errors.
    #

    #======================= Global Settings =======================

[    printers]
    comment = All Printers
;    browseable = yes
    path = /tmp
    printable = yes
    writeable = yes
    create mode = 0700
    valid users = avahi, sarge

    # Windows clients look for this share name as a source of downloadable
    # printer drivers
    [print$]
    comment = Printer Drivers
    path = /var/lib/samba/printers
;    browseable = yes
    writeable = yes
    valid users = avahi, sarge
    # Uncomment to allow remote administration of Windows print drivers.
    # Replace 'ntadmin' with the name of the group your admin users are
    # members of.
    ;   write list = root, @ntadmin

    # A sample share for sharing your CD-ROM with others.
    ;[cdrom]
    ;   comment = Samba server's CD-ROM
    ;   writable = no
    ;   locking = no
    ;   path = /cdrom
    ;   public = yes

    # The next two parameters show how to auto-mount a CD-ROM when the
    #       cdrom share is accesed. For this to work /etc/fstab must contain
    #       an entry like this:
    #
    #       /dev/scd0   /cdrom  iso9660 defaults,noauto,ro,user   0 0
    #
    # The CD-ROM gets unmounted automatically after the connection to the
    #
    # If you don't want to use auto-mounting/unmounting make sure the CD
    #       is mounted on /cdrom
    #
    ;   preexec = /bin/mount /cdrom
    ;   postexec = /bin/umount /cdrom


[Public]
    path = /home/sarge/Public
    writeable = yes
;    browseable = yes
    valid users = avahi, sarge

[Downloads]
    path = /home/sarge/Downloads
    writeable = yes
;    browseable = yes
    valid users = avahi, sarge

[Documents]
    path = /home/sarge/Documents
    writeable = yes
;    browseable = yes
    valid users = avahi, sarge
thats my smb.conf file in the beginning mint 9 found my windows printer right after i installed samba by going to add printer and using the command smb://MY-ip and installed driver but got errors trying to use it then messing around more made it wose now I can't find it.
Not sure what avahi is, didn't know what to choose when i had a list just wanted to add my user name and the user for the windows computer.

My workgroup name is linux on both machines the only thing that works is in virtualbox i can share file and folders from this maching but still cant see other machine or access anything on the winXP machine.

Sorry had to run fast just edited my post..
Last edited by sangre1077 on Sun Oct 03, 2010 3:45 pm, edited 2 times in total.
altair4
Level 20
Level 20
Posts: 11419
Joined: Tue Feb 03, 2009 10:27 am

Re: How To - Simple File Sharing in Mint

Post by altair4 »

Your post is very hard to read because you don't use any periods. I'm 125 years old and need periods to let me know when one thought ends and another begins. Anyway this HowTo is on using Nautilus-shares and you are using Classic-shares. If you start your own post I'll show you how to reset your smb.conf to the original form and maybe help you to your goal.

When you start your own topic you might want to make clearer if you are using VirtualBox or if this is a real install. Oh and just to clear one item up:
sudo service samba restart
It's going to get confusing around here because Debian does it one way and Ubuntu does it another but there is no "samba" service in Mint9 so the command would be:

Code: Select all

sudo service smbd restart
If you were using Mint Debian then the way you had it would have worked:

Code: Select all

sudo service samba restart
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
AbeFreeman

Re: How To - Simple File Sharing in Mint

Post by AbeFreeman »

Hi Altair,
I definitely want the automount in fstab option, so that the kids can just start up the computer and sign in and have access to the data. But after reading Fred's tutorial and your advice earlier in this tutorial regarding changing a line in fstab to :
UUID=284F243607E75E6A /media/Media ntfs defaults,nls=utf8,umask=000,gid=46 0 1 I am still not sure what to do. Fred said, "The mounting options I used above are typical and can be changed to meet your needs, if you so choose and know what you are doing" Problem is, I don't. And I don't know how to change that, except by asking one of you gurus.... so, Compared to the string above, Fred's example would not have included "nls=utf8", unmask=007 (but I want the 000, if I understood correctly) and the last "1" would be a zero. Fstab shows those as "options" and "pass", but where can I get a description of what the different options are, or what "pass" means?
What I did was use Fred's defaults but with unmask=000, and so far things seem to be working fine (kids can read files but not delete them).
AbeFreeman

Re: How To - Simple File Sharing in Mint

Post by AbeFreeman »

'Nother file sharing question:
I had this as a 2nd question in the same post, but realize now I should have split them, as it wasn't clear that I wasn't still talking about sharing my ntfs data partitions, but rather about those programs that store their own data somewhere else. Anki is an example, but there's also Evolution, Thunderbird, Media player playlists, etc, etc. For the Anki example, the kids have used it on the "main" user account and created a bunch of flash-cards that the program stores in /usr/godonlyknowswhere. If I want all users to be able to use that program (or any/all programs) with the same default data files, not each user having a program that acts like a data-less fresh install, how do I do that? WIth the Anki example, I'd like to share the files so that users can modify them, but some other ones, like Thunderbird, I would want read-only access.
altair4
Level 20
Level 20
Posts: 11419
Joined: Tue Feb 03, 2009 10:27 am

Re: How To - Simple File Sharing in Mint

Post by altair4 »

AbeFreeman, your last two posts have nothing to do with Samba and as this HowTo is about Samba file sharing I would suggest you post a new topic. When you do I would suggest supplying the output of the following commands so folks can help you faster:

Code: Select all

sudo blkid -c /dev/null

Code: Select all

cat /etc/fstab

Code: Select all

mount
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
WinterMint

Re: How To - Simple File Sharing in Mint

Post by WinterMint »

when connecting to a Windows share, how do i enter a folder name with a space in the name for example IT Documents?

thanks
B
altair4
Level 20
Level 20
Posts: 11419
Joined: Tue Feb 03, 2009 10:27 am

Re: How To - Simple File Sharing in Mint

Post by altair4 »

WinterMint, this HowTo is about sharing Mint folders to Windows or Linux. Your question is about access to a Windows share from Mint.

Anyway, I don't know where you are entering the name of the share. From the terminal - from nautilus. If you are entering it from Nautilus then it's:

Code: Select all

smb://192.168.0.100/IT%20Documents
The %20 takes the place of the space.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
MidnightWatcher

Re: How To - Simple File Sharing in Mint

Post by MidnightWatcher »

Is there a "How To" anywhere here like this that also shows us how to easily set up NFS shares?
Palice

Re: How To - Simple File Sharing in Mint

Post by Palice »

Hello

I have been reading through this and some other related threads looking for an answer to my problem. I am sure it's just me not properly understanding what to do, but here goes....

I have LMDE on 2 computers, one of which has an external hard drive which I would like to share with the other one.

I have followed the instruction in this thread, and have no problem sharing folders such as "Documents", "Music" ect ect, but when it comes to the external hard drivbe, I constantly get "you do not have the permissions necessary to view the contents of "My Passport". (My Passport is the name of the Hard drive obviously).

I have gone to the Media folder, opened it as Admin and shared the My Passport folder, but that didn't work. I also tried sharing individual folders within the My Passport drive, with no joy there either.

Here is the out put of "net usershare info --long"

Code: Select all

paddy@paddys-laptop ~ $ net usershare info --long
[documents]
path=/home/paddy/Documents
comment=
usershare_acl=Everyone:F,
guest_ok=y

[downloads]
path=/home/paddy/Downloads
comment=
usershare_acl=Everyone:F,
guest_ok=y

[music]
path=/home/paddy/Music
comment=
usershare_acl=Everyone:F,
guest_ok=y

[media]
path=/media
comment=
usershare_acl=Everyone:F,
guest_ok=y

[pictures]
path=/home/paddy/Pictures
comment=
usershare_acl=Everyone:F,
guest_ok=y

[my passport]
path=/media/My Passport
comment=
usershare_acl=Everyone:F,
guest_ok=y

[aussies]
path=/media/My Passport/Aussies
comment=
usershare_acl=Everyone:F,
guest_ok=y

[public]
path=/home/paddy/Public
comment=
usershare_acl=Everyone:F,
guest_ok=y

Any assistance in this would be greatly appreciated.

Thank you!
altair4
Level 20
Level 20
Posts: 11419
Joined: Tue Feb 03, 2009 10:27 am

Re: How To - Simple File Sharing in Mint

Post by altair4 »

The problem with the external hard drive is most likely not a Samba issue but a Linux file permissions issue. If "My Passport" holds an NTFS or FAT32 formatted partition then it will mount with you as owner and with read / write permissions only for you and no one else. When you created your share you allowed guest access. "Guest" is not you so access is denied. You can have samba fix this issue by creating a mask that will convert "guest" to you - at least as far as that share is concerned:

Edit smb.conf as root:

Code: Select all

gksu gedit /etc/samba/smb.conf
Add the following line to the [global] section of smb.conf:

Code: Select all

force user = your-mint-login-name
Save the file and restart samba:

Code: Select all

sudo service samba restart
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Palice

Re: How To - Simple File Sharing in Mint

Post by Palice »

Thank you altair4.

You pointed out something I should have noticed....it was an NTFS file system. Usually I re format all my external hard drives before I use them, but I forgot.

Reformatting as I type this, and will post back with the results.

I have read some of your posts on this forum, and you are most learned and patient, thank you.
Palice

Re: How To - Simple File Sharing in Mint

Post by Palice »

All done, re formatted to ext 4 and now there are no problems.

Thanks again.
daibak
Level 1
Level 1
Posts: 25
Joined: Fri Nov 19, 2010 4:19 pm

Re: How To - Simple File Sharing in Mint

Post by daibak »

altair4,

After trying the most simple set-up you described, a Nautilus file share, on my Linux Mint 10 (8-yr-old HP Pavilion) Notebook PC I was still frustrated for a couple of hours with a second Windows Vista laptop on the same home network both behind a router to the Internet as only the Mint shared directory showed up on the Windows machine; but, of the shared directory on the Windows machine, not a sign on the Linux Mint 10 box. After trying umpteen things in vain to fix it which I can no longer recall in detail I went back to your original instructions and tried this gem when I recalled the Nautilus share wizard had never asked me for the workgroup name:

(2) There is a bug in the nautilus-share package as of this writing that does not change the username and groupname to your name and group for any file that a remote user adds to your share. This makes it impossible for you to write to that file. Here is a workaround: add the following line to the [global] section of etc/samba/smb.conf :
force user = whatever_your_mint_user_name_is
So, as you said, I opened etc/samba/smb.conf in gedit and added this line all on its own at the very end of the Global section and saved it:

Code: Select all

force user = mylinuxmint10username

(I inserted this username line without any leading semi-colon)

Voilá, by miracle, Linux Mint 10 now shows the second Windows Vista machine and I can read and write to its directory.

Bless you, good sir!
daibak
llogg

Re: How To - Simple File Sharing in Mint

Post by llogg »

daibak wrote:altair4,

After trying the most simple set-up you described, a Nautilus file share, on my Linux Mint 10 (8-yr-old HP Pavilion) Notebook PC I was still frustrated for a couple of hours with a second Windows Vista laptop on the same home network both behind a router to the Internet as only the Mint shared directory showed up on the Windows machine; but, of the shared directory on the Windows machine, not a sign on the Linux Mint 10 box. After trying umpteen things in vain to fix it which I can no longer recall in detail I went back to your original instructions and tried this gem when I recalled the Nautilus share wizard had never asked me for the workgroup name:

(2) There is a bug in the nautilus-share package as of this writing that does not change the username and groupname to your name and group for any file that a remote user adds to your share. This makes it impossible for you to write to that file. Here is a workaround: add the following line to the [global] section of etc/samba/smb.conf :
force user = whatever_your_mint_user_name_is
So, as you said, I opened etc/samba/smb.conf in gedit and added this line all on its own at the very end of the Global section and saved it:

Code: Select all

force user = mylinuxmint10username

(I inserted this username line without any leading semi-colon)

Voilá, by miracle, Linux Mint 10 now shows the second Windows Vista machine and I can read and write to its directory.

Bless you, good sir!
daibak
I second this post. Thank you for this thread. Incredibly helpful.
Post Reply

Return to “Tutorials”