File Sharing - Windows Client - Linux Server

Connection sharing, Firewall, Samba..etc
Forum rules
Before you post please read this

File Sharing - Windows Client - Linux Server

Postby WhatUsernameIsFree? on Mon Apr 16, 2012 2:58 pm

Hi all,

Currently I use SSHFS to share files amongst all my Linux clients, however, I have a new to me Windows 7 (Home Edition) computer. Now, if you think I'm a Linux newbie (I am) I'm even worse on Windows. Generally I can follow 'how to's though.

What's the easiest way to share files? Ideally I'd like to use SSHFS as it's up and working, however, I can't even find the terminal in Windows, let alone if it can do SSHFS.

I think 'SMB' is what I'll need to use, but is it secure/encrypted? Is there an easy way to get it working? When I searched for guides for 'SMB' there are many forum posts with users struggling to get it working.

Thanks for thoughts and advice.

WUIF
WhatUsernameIsFree?
Level 4
Level 4
 
Posts: 210
Joined: Wed Oct 19, 2011 1:32 pm

Linux Mint is funded by ads and donations.
 

Re: File Sharing - Windows Client - Linux Server

Postby altair4 on Mon Apr 16, 2012 3:29 pm

I've never used ssh between Windows and Linux so I can't help you with that other than to suggest WinSCP ( on WIndows ) as something that you might want to look at.

As for Samba ( SMB ) this is the easiest way to create shares on Linux:
Simple File Sharing in Mint: viewtopic.php?f=42&t=23169
It's very reminiscent of creating a share on WinXP.

If you get into trouble browsing to the shares instead of accessing them directly by ip address go through this checklist:
Samba Browsing Problems Checklist: viewtopic.php?f=42&t=88146&start=0
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 13
Level 13
 
Posts: 4657
Joined: Tue Feb 03, 2009 10:27 am

Re: File Sharing - Windows Client - Linux Server

Postby WhatUsernameIsFree? on Tue Apr 17, 2012 12:50 pm

I'll give it a go. Thanks :)
WhatUsernameIsFree?
Level 4
Level 4
 
Posts: 210
Joined: Wed Oct 19, 2011 1:32 pm

Re: File Sharing - Windows Client - Linux Server

Postby WhatUsernameIsFree? on Wed Apr 18, 2012 5:14 am

Hi,

I gave it a go, I can see the shares on the Windows machine, but stupidly I think I typed in the wrong user name and password and set it to remember the password. It now just comes up with Access denied. I've tried DuckDuckGoing the problem, but I'm unsure how to change the user name and password that Windows is remembering.

The share just says access denied, but I'm not even 100% sure I did give the wrong user name and password. I can access my folders if I change the 'Permissions for others' box to 'Access Files', but I don't really want that, as I think that'll mess up my shares with SSHFS. I have a group set up which I add users to so they can access limited files on my computer.

Any ideas? Is there a better way to manage my groups? I guess that there must be a 'smb' group somewhere which is being refused access to the files. Can I add two groups to have access?

Thanks
WhatUsernameIsFree?
Level 4
Level 4
 
Posts: 210
Joined: Wed Oct 19, 2011 1:32 pm

Re: File Sharing - Windows Client - Linux Server

Postby altair4 on Wed Apr 18, 2012 6:31 am

The best thing to do is for you to tell us how you are set up. Please post the output of the following commands:
Code: Select all
testparm -s

Code: Select all
net usershare info --long


If you have set up a share that requires authentication and you set others to "none" then this isn't going to work since the underlying linux folder has permissions of 750 or 770. So let's say you created a share of your Videos folder in your home directory. It's going to have:

owner = altair
group = altair
mode = 750 or 770

You can create a "special" group, change the group of the folder, and add all the remote users to that group:
Code: Select all
chown :special /home/altair/Videos

Then change permissions:
Code: Select all
chmod 2770 /home/altair/Videos

The "2" ( setgid ) will make all new files and folders "inherit" the group of the shared folder.

If you want to have multiple groups have access to the share then you can't do that in Linux but you can do that in Samba but you will have to abandon the creation of those shares from Nautilus. The classic samba share can handle that type of situation and we can create one once we see how you are set up.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 13
Level 13
 
Posts: 4657
Joined: Tue Feb 03, 2009 10:27 am

Re: File Sharing - Windows Client - Linux Server

Postby WhatUsernameIsFree? on Wed Apr 18, 2012 7:57 am

Code: Select all
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE
[global]
   server string = %h 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

[homes]
   comment = Home Directories
   valid users = %S
   create mask = 0700
   directory mask = 0700
   browseable = No

[printers]
   comment = All Printers
   path = /var/spool/samba
   create mask = 0700
   printable = Yes
   print ok = Yes
   browseable = No

[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers


Code: Select all
[Audio]
path=/media/media/Audio
comment=
usershare_acl=Everyone:R,Unix User\whatusernameisfree:F,
guest_ok=n

[Music]
path=/media/media/Music
comment=
usershare_acl=Everyone:R,Unix User\whatusernameisfree:F,
guest_ok=n


I'm afraid you lost me on the groups. At the moment, if a user wants to access my media, I create a user for them, put them in the remotemedia group and then they can access the folder. Is the problem that samba users belong to a group that doesn't have access, or that the users created for samba aren't in the remotemedia group? (I hope I've understood the problem).

I do have folders that I don't want people to be able to view, hence the use of the 0 (no access) for others in some groups. I don't want some people access to my Videos as if they down load my ripped BlueRays that's all my monthly bandwidth gone in one download (or so).

Thanks :)
WhatUsernameIsFree?
Level 4
Level 4
 
Posts: 210
Joined: Wed Oct 19, 2011 1:32 pm

Re: File Sharing - Windows Client - Linux Server

Postby altair4 on Wed Apr 18, 2012 8:15 am

What are the permissions of the target folder:
Code: Select all
ls -dl /media/media/Audio

Code: Select all
ls -dl /media/media/Music

There is no samba user. You create a local user on the server that represents the remote user ( example: remoteuser ) and then add that user to the samba password database:
Code: Select all
sudo smbpasswd -a remoteuser
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 13
Level 13
 
Posts: 4657
Joined: Tue Feb 03, 2009 10:27 am

Re: File Sharing - Windows Client - Linux Server

Postby WhatUsernameIsFree? on Wed Apr 18, 2012 8:45 am

Code: Select all
drwxr-x--- 83 whatusernameisfree remotemedia 4096 Apr  7 17:04 /media/media/Music


Code: Select all
drwxr-x--- 9 whatusernameisfree remotemedia 4096 Jun 21  2011 /media/media/Audio


Earlier, whilst following the guide earlier I did this:
Code: Select all
sudo smbpasswd -a whatusernameisfree7
as the username to enter from Windows 7? Or should I add whatusernameisfree7 to the remotemedia group?

I'm really sorry, I feel like I just don't really understand what's happening and am very grateful for your patience with me. :)
WhatUsernameIsFree?
Level 4
Level 4
 
Posts: 210
Joined: Wed Oct 19, 2011 1:32 pm

Re: File Sharing - Windows Client - Linux Server

Postby altair4 on Wed Apr 18, 2012 8:58 am

Or should I add whatusernameisfree7 to the remotemedia group?

Yes.

I thought you already did that for ssh and were using the same users:
At the moment, if a user wants to access my media, I create a user for them, put them in the remotemedia group and then they can access the folder
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 13
Level 13
 
Posts: 4657
Joined: Tue Feb 03, 2009 10:27 am

Re: File Sharing - Windows Client - Linux Server

Postby WhatUsernameIsFree? on Wed Apr 18, 2012 9:14 am

altair4 wrote:I thought you already did that for ssh and were using the same users:
At the moment, if a user wants to access my media, I create a user for them, put them in the remotemedia group and then they can access the folder


Hi, sorry for the confusion. I'm not sure that Windows actually has SSH, so I never added my username on my Windows7 PC to that group.

I've now added it with
Code: Select all
sudo usermod -a -G remotemedia whatusernameisfree7


Windows, when I try connect says
Code: Select all
Windows cannot access \\DESKTOP\Audio
You do not have permission to access \\DESKTOP\Audio. Contact your network administrator to request access.
WhatUsernameIsFree?
Level 4
Level 4
 
Posts: 210
Joined: Wed Oct 19, 2011 1:32 pm

Re: File Sharing - Windows Client - Linux Server

Postby altair4 on Wed Apr 18, 2012 9:19 am

Did you logout and login again for the group membership to take affect?
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 13
Level 13
 
Posts: 4657
Joined: Tue Feb 03, 2009 10:27 am

Re: File Sharing - Windows Client - Linux Server

Postby WhatUsernameIsFree? on Wed Apr 18, 2012 9:25 am

altair4 wrote:Did you logout and login again for the group membership to take affect?


Aye, but I've rebooted both computers for good measure (rebooting seems to fix most Windows problems I've found) but there's no difference.
WhatUsernameIsFree?
Level 4
Level 4
 
Posts: 210
Joined: Wed Oct 19, 2011 1:32 pm

Re: File Sharing - Windows Client - Linux Server

Postby altair4 on Wed Apr 18, 2012 9:31 am

I will try later today if I can to try to reproduce your symptoms. I have Win7 Pro however so I don't know how this affects the outcome.

You could run the following command to make sure that whatusernameisfree7 is in fact a member of the remotemedia group:
Code: Select all
sudo id whatusernameisfree7
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 13
Level 13
 
Posts: 4657
Joined: Tue Feb 03, 2009 10:27 am

Re: File Sharing - Windows Client - Linux Server

Postby WhatUsernameIsFree? on Wed Apr 18, 2012 10:04 am

Hi thanks

Code: Select all
uid=1004(whatusernameisfree7) gid=1005(whatusernameisfree7) groups=1005(whatusernameisfree7),1002(remotemedia)


I'm thankful for your help.

Just to run past the 'chmod' for the folder, what numbers should they have to ensure that only the owner has full access, remotemedia has read only access and other have no access? Was that it 'chmod -R 2750'? I normally just use the right-click screen. :)

Thanks

WUIF
WhatUsernameIsFree?
Level 4
Level 4
 
Posts: 210
Joined: Wed Oct 19, 2011 1:32 pm

Re: File Sharing - Windows Client - Linux Server

Postby altair4 on Wed Apr 18, 2012 10:37 am

You can use this if all you want to do is allow read access:
Code: Select all
sudo chmod 0750 /path

The "2" is to insure that anything added to the folder will have the right group

But remember this isn't ssh where the remote user becomes the local user. This is samba so there's a mix of Linux permissions and Samba permissions.

If you set your folder to 777 then everyone and your Aunt Tilly has local access. But your samba share looks like this:
[Audio]
path=/media/media/Audio
comment=
usershare_acl=Everyone:R,Unix User\whatusernameisfree:F,
guest_ok=n

The owner in this particular case has full access:
Unix User\whatusernameisfree:F

And everyone else only has read access:
usershare_acl=Everyone:R

And you've effectively eliminated "others" from access because of this:
guest_ok=n


Samba can remove permissions but it cannot add permissions to the one defined by Linux.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 13
Level 13
 
Posts: 4657
Joined: Tue Feb 03, 2009 10:27 am

Re: File Sharing - Windows Client - Linux Server

Postby WhatUsernameIsFree? on Sun Apr 22, 2012 12:57 pm

Hi,

With the above, would that not then permit all Linux users (using SSHFS) to download whatever they like from me? Some users (my other laptop for example for example) can do that, but some are remote and I don't want them downloading my high def films. They'll burn my data allowance in one hit.
WhatUsernameIsFree?
Level 4
Level 4
 
Posts: 210
Joined: Wed Oct 19, 2011 1:32 pm

Re: File Sharing - Windows Client - Linux Server

Postby altair4 on Sun Apr 22, 2012 2:38 pm

First, I cannot reproduce this error based on how you are set up:
Windows cannot access \\DESKTOP\Audio
You do not have permission to access \\DESKTOP\Audio. Contact your network administrator to request access.


Second,
With the above, would that not then permit all Linux users (using SSHFS) to download whatever they like from me? Some users (my other laptop for example for example) can do that, but some are remote and I don't want them downloading my high def films


Yes it will. I was using that as an example of how Samba works. How there are two components of permissions - one Linux and the other Samba.

Depending on how you have sshsf set up it's somewhat academic though. If I access another machine using the following command:
Code: Select all
sshfs altair@192.168.0.100:/ /home/tester1/Test

tester1 has access ( read only mostly ) to the entire server filesystem. I can transfer what I please.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 13
Level 13
 
Posts: 4657
Joined: Tue Feb 03, 2009 10:27 am

Re: File Sharing - Windows Client - Linux Server

Postby WhatUsernameIsFree? on Sun Apr 22, 2012 2:49 pm

I think I found the problem. It's the 'others' section. If anyone (including my Aunt Tilly) can read the folder then Samba works. If only a select group can read it, and others is set to 'None', then they can't. I expect that should reproduce the error I'm getting.

Guess I can either have SSHFS with permissions or Samba and SSHFS with pretty uncontrolled permissions.
WhatUsernameIsFree?
Level 4
Level 4
 
Posts: 210
Joined: Wed Oct 19, 2011 1:32 pm

Re: File Sharing - Windows Client - Linux Server

Postby altair4 on Sun Apr 22, 2012 3:36 pm

** I set up a share on my Mint system at /home/altair/Test that does not allow guest access and does not allow write.

** I changed permissions on the underlying linux folder to 750 to match yours

** I changed group to plugdev so that it reads:
drwxr-x--- altair plugdev /home/altair/Test


** I set up a user named tester1 and made him a member of the plugdev group.

** I added tester1 to the samba password database.

When I access this share from Win7 as tester1 I have read only access to the share. The only way I can get an error resembling this one:
Windows cannot access \\DESKTOP\Audio
You do not have permission to access \\DESKTOP\Audio. Contact your network administrator to request access.

Is if I change the group back to altair

Like I said before I cannot reproduce your symptoms.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 13
Level 13
 
Posts: 4657
Joined: Tue Feb 03, 2009 10:27 am

Linux Mint is funded by ads and donations.
 

Return to Other networking topics

Who is online

Users browsing this forum: No registered users and 7 guests