file sharing in mixed network

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

file sharing in mixed network

Postby exxil on Sat Nov 03, 2012 5:51 am

I am sharing a folder on my linux mint machine with an ubunut machine and two windows machines on my home network, pluss one windows machine accessing the share through sftp over the internet.

The folder is stored under user 1's home directory on the linux mint, but most of the files are created and modified by the windows machines.

The problems we are facing is that we very often only get to open the files in read only, which of course is very annoying if you need to edit the file.
Sometimes it seem like a random thing whether you will be able to edit at a certain time or not, and sometimes even, if you close and reopen the file you may be able to edit it, and it is not because somebody else is having the file open :(

This is a brief overview of my configurations:
samba settings:

[shared data]
path = /home/user1/folder1
read only = no
guest ok = yes
force user = user1

Could something be added here perhaps, something like the chmod 777 so that all folders and files created here at any time is editable for everyone?

I also set the folders to share in nautilus, but using samba perhaps I could just remove this? Could it be creating some kind of conflict with samba, perhaps?

In the sshd_config file user 2 which is the sftp user is set to be the only user allowed and the user is created on the linux mint machine.

I have run
Code: Select all
chmod -R 777 /home/user1/folder1
and it seems to fix it for a while, but it flips back and gives us the read only thing.

One thing I have noticed, but I don't know if it plays a role in this is that user 1 seems to be in a group called user 1 and user 2 in a group called user 2.

I would kind of have expected them to be in a group called homegroup (name of the home network).

I am not a very advanced linux user, as you can see, and this issue is driving me nuts.
exxil
Level 1
Level 1
 
Posts: 39
Joined: Sat Jun 16, 2012 3:54 am

Linux Mint is funded by ads and donations.
 

Re: file sharing in mixed network

Postby altair4 on Sat Nov 03, 2012 7:20 am

The first thing I would do is fix this since it's not a good idea to create a samba share using 2 different methods on the same target folder:
I also set the folders to share in nautilus, but using samba perhaps I could just remove this? Could it be creating some kind of conflict with samba, perhaps?

Creating a share via Nautilus is creating a samba share - called a Samba Usershare - and it's share definition is located ar /var/lib/samba/usershares. Since you already have a share defined in smb.conf - Called a Samba Classic Share - you may indeed have a conflict. For what you are attemping to do you could remove the classic share from smb.conf and add the "force user = user1" line to the [global] section - right under the workgroup line - then restart samba.

If that doesn't resolve the issue post the output of the following commands:
Code: Select all
testparm -s
net usershare info --long
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5802
Joined: Tue Feb 03, 2009 10:27 am

Re: file sharing in mixed network

Postby exxil on Sun Nov 04, 2012 6:03 am

I have tried to remove the sharing through nautilus, by going right-click on the folder and to share and remove the tick, but the system sets it right back again. I have tried with the root account too, but that account does not even have the option to remove the share.

Could I just to into the /var/lib/samba/usershares and clear out the files in there, perhaps?

I ran the commands you said and the output does not look good, does it?
Also just today I started getting the error you see on the very top just when I open the terminal:
---------
bash: /usr/bin/mint-fortune: No such file or directory

Mint@user1 ~ $ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[printers]"
Processing section "[print$]"
Processing section "[shared data]"
Loaded services file OK.
Server role: ROLE_STANDALONE
[global]
workgroup = Home
server string = %h server (Samba, Ubuntu)
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

[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

[shared data]
path = /home/user1/Downloads
force user = user1
read only = No
guest ok = Yes

user1@Mint ~ $ net usershare info --long
info_fn: file /var/lib/samba/usershares/factura&pagos is not a well formed usershare file.
info_fn: Error was Path is not a directory.
info_fn: file /var/lib/samba/usershares/iva_21 is not a well formed usershare file.
info_fn: Error was Path is not a directory.
info_fn: file /var/lib/samba/usershares/nominas is not a well formed usershare file.
info_fn: Error was Path is not a directory.
[MM]
path=/home/user1/Downloads/MM
comment=
usershare_acl=Everyone:F,
guest_ok=n

[Sirim2012_julio]
path=/home/user1/Downloads/MM/Sirim2012_julio
comment=
usershare_acl=Everyone:F,
guest_ok=n

info_fn: file /var/lib/samba/usershares/pagos is not a well formed usershare file.
info_fn: Error was Path is not a directory.
[curris]
path=/home/user1/Downloads/MM/curris
comment=
usershare_acl=Everyone:R,USER1\(null):F,
guest_ok=n

[Pedidos]
path=/home/user1/Downloads/MM/Pedidos
comment=
usershare_acl=Everyone:F,
guest_ok=n

[Apertura]
path=/home/user1/Downloads/MM/Apertura
comment=
usershare_acl=Everyone:F,
guest_ok=n

[Gestoria]
path=/home/user1/Downloads/MM/Gestoria
comment=
usershare_acl=Everyone:F,
guest_ok=n

[CC_MM]
path=/home/user1/Downloads/MM/CC_MM
comment=
usershare_acl=Everyone:R,USER1\(null):F,
guest_ok=n

[Swatch]
path=/home/user1/Downloads/MM/Swatch
comment=
usershare_acl=Everyone:F,
guest_ok=n

[Varios]
path=/home/user1/Downloads/MM/Varios
comment=
usershare_acl=Everyone:F,
guest_ok=n

[BckupHistorico]
path=/home/user1/Downloads/MM/BckupHistorico
comment=
usershare_acl=Everyone:F,
guest_ok=n

user1@Mint ~ $ ^C
-----------------------------

Thanks for taking the time :)
exxil
Level 1
Level 1
 
Posts: 39
Joined: Sat Jun 16, 2012 3:54 am

Re: file sharing in mixed network

Postby altair4 on Sun Nov 04, 2012 8:57 am

That's a bit of a mess from a security standpoint.

You have a classic share ( "shared data" @ /home/user1/Downloads ) that allows full access to guests.

You have a whole bunch of usershares based off subdirectories of /home/user1/Downloads that do not allow guests - for example: "MM" @ /home/user1/Downloads/MM . If I were to find myself on your network, do not have a samba password, and therefore a guest it's true that I cannot access the MM share but I can access the /home/user1/Downloads/MM folder through the "shared data" share.

Likewise, all these shares that are created off subdirectories of /home/user1/Downloads/MM are redundant since access to the MM share grants me access to all of it's content.

I'm not sure what you are trying to achieve with this set up. Do you want users to authenticate or not?
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5802
Joined: Tue Feb 03, 2009 10:27 am

Re: file sharing in mixed network

Postby exxil on Sun Nov 04, 2012 9:20 am

the nautilus shares I tried to set up as I would have done on a windows machine. But then I found that samba would probably be more suitable for my needs. So if possible I would like to turn off the shares created through nautilus and only use samba share and sftp access for the user accessing through internet.

The user accessing through internet (user2) only needs to access the MM folder. I would like the linux and windows computers on the home network to access the Downloads and the MM folder (currently store within the Downloads folder).

The user accessing through internet has to authenticate with correct username and password. When accessing over the home network I would like to be able to access without having to authenticate.

Would this be possible?
exxil
Level 1
Level 1
 
Posts: 39
Joined: Sat Jun 16, 2012 3:54 am

Re: file sharing in mixed network

Postby altair4 on Sun Nov 04, 2012 10:30 am

the nautilus shares I tried to set up as I would have done on a windows machine. But then I found that samba would probably be more suitable for my needs.

The shares you created through Nautilus are samba shares. If you don't want them anymore and since you have so many just go to /var/lib/samba/usershares and delete the definition files you see there.
I would like the linux and windows computers on the home network to access the Downloads and the MM folder (currently store within the Downloads folder).... When accessing over the home network I would like to be able to access without having to authenticate.

This is the Classic Samba share you have in smb.conf:
[shared data]
path = /home/user1/Downloads
force user = user1
read only = No
guest ok = Yes

Every user on your local network has read/write access to the /home/user1/Downloads folder and all of it's contents including but not restricted to the MM folder. You can't share the Downloads folder without sharing everything within it.

As far as your sftp question I would start another thread. I did this once so long ago I don't even remember where I was living at the time. I just remember that it involved port forwarding and something about chroot'ing.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5802
Joined: Tue Feb 03, 2009 10:27 am

Re: file sharing in mixed network

Postby exxil on Sun Nov 04, 2012 11:18 am

Thank you :)
exxil
Level 1
Level 1
 
Posts: 39
Joined: Sat Jun 16, 2012 3:54 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 8 guests