Sharing usb drive plugged in linux with windows machine

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
boysha
Level 3
Level 3
Posts: 133
Joined: Tue Jul 03, 2007 1:03 pm
Location: Victoria, BC, Canada
Contact:

Sharing usb drive plugged in linux with windows machine

Post by boysha »

Hi,
I would appreciate any help with this.
I have 2 computers. One has Mint 8 and another has Windows XP. Mint machine has an external drive.
I am sharing that drive and I can map it on the Windows machine but it wouldn't let me open that drive.
How can I fix this?
Thank you in advance!
Cheers!
Neb
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
hillmort

Re: Sharing usb drive plugged in linux with windows machine

Post by hillmort »

what type off file system are you using on the external drive?
you might have to back the drive up and reformat it as a different type of file system.
deleted

Re: Sharing usb drive plugged in linux with windows machine

Post by deleted »

You shouldn't have to change the format of the drive.
How are you sharing it from Mint?
Have you installed samba on Mint?
Have you created a samba user on Mint? (sudo smbpasswd -a [user])

-H
User avatar
boysha
Level 3
Level 3
Posts: 133
Joined: Tue Jul 03, 2007 1:03 pm
Location: Victoria, BC, Canada
Contact:

Re: Sharing usb drive plugged in linux with windows machine

Post by boysha »

Hi,
I just plugged in my external drive to a usb port. I can use the drive in Mint without any problem.
What I wanted to do is, have my other windows xp machine see and be able to open that drive.
I gave it a full share permission on Mint and like I said, I can see the drive in Windows XP but it
doesn't let me open the drive.
Any thoughts?
altair4
Level 20
Level 20
Posts: 11457
Joined: Tue Feb 03, 2009 10:27 am

Re: Sharing usb drive plugged in linux with windows machine

Post by altair4 »

The external usb drive, if formatted to FAT32 / NTFS, will automatically mount with you as the owner and with permissions to read and write granted to you and no one else. When you created a share on Mint to that drive you posted that you allowed guest access. Samba acts as a gatekeeper and determines who can access the share. But it can't override the linux permissions on the filesystem itself.

There's two ways to fix this:

(1) Create an entry in fstab to have that usb drive mount to a specific point every time it's inserted and set permissions to allow guest access. "Other" access in linux = "Guest" access in samba. This could get complicated if you have many usb storage devices because each one will need a separate entry in fstab.

(2) There is another way that uses Samba itself to work around this problem.

Open Terminal
Type gksu gedit /etc/samba/smb.conf

Add the following line to the [global] section of smb.conf:

force user = your_Mint_user_name

EDIT: note that that's your own login user name. There's no need for a smbpasswd addition or any other modification.

Save the file, exit gedit, and back in the terminal type: sudo service samba restart

When the Windows guest is allowed access by Samba it will appear to Mint as though the user is you ( as far as that share is concerned ).
Last edited by altair4 on Wed Jan 20, 2010 9:48 am, edited 2 times in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
deleted

Re: Sharing usb drive plugged in linux with windows machine

Post by deleted »

boysha wrote:Hi,
I just plugged in my external drive to a usb port. I can use the drive in Mint without any problem.
What I wanted to do is, have my other windows xp machine see and be able to open that drive.
I gave it a full share permission on Mint and like I said, I can see the drive in Windows XP but it
doesn't let me open the drive.
Any thoughts?
Did you add a a samba user in Mint using:
as root
smbpasswd -a [user]

This will allow a user in windows to log in an use the samba share, regardless of disk format.
I share disks formatted ext4, ext3, jfs through samba.

-Hinto
altair4
Level 20
Level 20
Posts: 11457
Joined: Tue Feb 03, 2009 10:27 am

Re: Sharing usb drive plugged in linux with windows machine

Post by altair4 »

Adding a samba user simply complicates the matter. Why require a username and password to access a guest share?

EDIT: And what password are you going to give the samba user? The same one the server uses to login. Now the remote user knows the local server user's login name and password.

Are you going to create a samba user for the remote user? And what password are you going to use for that? The remote user's username and password? Now the Server user knows the login username and password of the remote user.
deleted

Re: Sharing usb drive plugged in linux with windows machine

Post by deleted »

altair4 wrote:Adding a samba user simply complicates the matter. Why require a username and password to access a guest share?

EDIT: And what password are you going to give the samba user? The same one the server uses to login. Now the remote user knows the local server user's login name and password.

Are you going to create a samba user for the remote user? And what password are you going to use for that? The remote user's username and password? Now the Server user knows the login username and password of the remote user.
As far as I know, there's no way around it for secure file access. Also, check /etc/samba/smb.conf to see the settings for samba shares. There you have to edit what is visible as well as if guests are allowed (not to mention read/write access)
altair4
Level 20
Level 20
Posts: 11457
Joined: Tue Feb 03, 2009 10:27 am

Re: Sharing usb drive plugged in linux with windows machine

Post by altair4 »

hinto wrote:As far as I know, there's no way around it for secure file access. Also, check /etc/samba/smb.conf to see the settings for samba shares. There you have to edit what is visible as well as if guests are allowed (not to mention read/write access)
You're assuming he's using Classic Samba where the shares are defined in smb.conf. I'm assuming he's using natulus-share where the shares are defined in /var/lib/samba/usershares. A nautilus-share definition looks like this:
[winj]
path=/windows/J
comment=
usershare_acl=Everyone:F,
guest_ok=y
Either way he's allowing "guest access" or to put it in Classic Samba terminology a "Public" share. Even if he where using Classic sharing the force user would still work, you'd just have to add it to the share definition portion of smb.conf instead of the global section.

I'm betting he went into Nautilus, right clicked the /media/whatever folder, Selected "Sharing Options" and said share this darn thing and check off all the boxes allowing among other things guest access. Guest access is not going to work unless he changes how the usb device mounts, changes permissions after it is mounted to allow others to write ( ext3, etc..), or uses force user.

It could very well be that I'm misinterpreting the original post and that he wants to have these shares authenticated requiring a username and password before a remote user is allowed access. In that case I don't disagree with most of what you've written.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
deleted

Re: Sharing usb drive plugged in linux with windows machine

Post by deleted »

Thanks for the clarification. I learn something new everyday.
-Hinto
User avatar
boysha
Level 3
Level 3
Posts: 133
Joined: Tue Jul 03, 2007 1:03 pm
Location: Victoria, BC, Canada
Contact:

Re: Sharing usb drive plugged in linux with windows machine

Post by boysha »

altair4 wrote:The external usb drive, if formatted to FAT32 / NTFS, will automatically mount with you as the owner and with permissions to read and write granted to you and no one else. When you created a share on Mint to that drive you posted that you allowed guest access. Samba acts as a gatekeeper and determines who can access the share. But it can't override the linux permissions on the filesystem itself.

There's two ways to fix this:

(1) Create an entry in fstab to have that usb drive mount to a specific point every time it's inserted and set permissions to allow guest access. "Other" access in linux = "Guest" access in samba. This could get complicated if you have many usb storage devices because each one will need a separate entry in fstab.

(2) There is another way that uses Samba itself to work around this problem.

Open Terminal
Type gksu gedit /etc/samba/smb.conf

Add the following line to the [global] section of smb.conf:

force user = your_Mint_user_name

EDIT: note that that's your own login user name. There's no need for a smbpasswd addition or any other modification.

Save the file, exit gedit, and back in the terminal type: sudo service samba restart

When the Windows guest is allowed access by Samba it will appear to Mint as though the user is you ( as far as that share is concerned ).
Thank you, Altair4!
I will do what you said and if I don't place another reply - that means it worked and is fine.
Cheers!
Neb
User avatar
boysha
Level 3
Level 3
Posts: 133
Joined: Tue Jul 03, 2007 1:03 pm
Location: Victoria, BC, Canada
Contact:

Re: Sharing usb drive plugged in linux with windows machine

Post by boysha »

altair4 wrote:The external usb drive, if formatted to FAT32 / NTFS, will automatically mount with you as the owner and with permissions to read and write granted to you and no one else. When you created a share on Mint to that drive you posted that you allowed guest access. Samba acts as a gatekeeper and determines who can access the share. But it can't override the linux permissions on the filesystem itself.

There's two ways to fix this:

(1) Create an entry in fstab to have that usb drive mount to a specific point every time it's inserted and set permissions to allow guest access. "Other" access in linux = "Guest" access in samba. This could get complicated if you have many usb storage devices because each one will need a separate entry in fstab.

(2) There is another way that uses Samba itself to work around this problem.

Open Terminal
Type gksu gedit /etc/samba/smb.conf

Add the following line to the [global] section of smb.conf:

force user = your_Mint_user_name

EDIT: note that that's your own login user name. There's no need for a smbpasswd addition or any other modification.

Save the file, exit gedit, and back in the terminal type: sudo service samba restart

When the Windows guest is allowed access by Samba it will appear to Mint as though the user is you ( as far as that share is concerned ).
Yeah! It worked like a charm!
Thank you again.
All the best,
Neb
[closed]
diosif

Re: Sharing usb drive plugged in linux with windows machine

Post by diosif »

Thank you, it was exactly the solution i was looking for! It worked for me too!
danneauxs

Re: Sharing usb drive plugged in linux with windows machine

Post by danneauxs »

This is perfect advice even today. I've been struggling with this for a while. It was just today that I noticed the shares that didn't work were on my USB hard drive. Finding this thread let me keep what little hair I haven't pulled out.

Thanks
creekblue

Re: Sharing usb drive plugged in linux with windows machine

Post by creekblue »

Thanks for the post danneauxs, and especially thanks to altair4 - yes, perfect advice even today. I pulled my hair out most of the day today pouring over samba how-to's, forum posts, and more. If I could only have those hours back, when this solution solved my problem in seconds. I have a small home network - my wife and 18 year old daughter use windows 10. I wanted to share several folders of photos, videos, and files. I wanted them to have read/write access without fuss. Nothing seemed to work, but this did and it works PERFECT on my home network for my needs.
opale7000

Re: Sharing usb drive plugged in linux with windows machine

Post by opale7000 »

Hello

Glad to have found this old thread about sharing a usb drive on linux mint. In my case I was having trouble getting my iOs devices to connect. If this can help in the future I had to both use

Code: Select all

force user = your_Mint_user_name
and

Code: Select all

sudo smbpasswd -a [user
Locked

Return to “Networking”