Page 1 of 3

Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 6:02 am
by GJQ
Dear all,
I have got 2 linux mint machine running version 14 (64bits). Is there any way to share the files between them which are having same workgroup name. I have tried samba but it is not working. I need the files to be share for editing by either of the machine. Therefore read and write access is very important but I just can't get it set up working nicely. Is there any other alternatives beside Samba?

Appreciate all help and advise given.
Thanks

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 6:20 am
by usbtux
You should be able to brows the network,
Home Folder,
network, (bottom left)
Windows network (in my case) MSHOME, or WORKGROUP,
Then you should see connected computers,
Double click on the required computer and it'll ask for connection details, user, network ( mshome or workgroup) password.
Click ok and you should be able to connect to any shares you've already setup...

This may help http://forums.linuxmint.com/viewtopic.php?f=90&t=107272 setting up the shares :)

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 7:33 am
by altair4
I have tried samba but it is not working.
Therefore read and write access is very important but I just can't get it set up working nicely.
If you are interested in diagnosing the problem with Samba let me know but you will need to be a wee bit more descriptive with your description of the problem. It's not clear from your post if you cannot see the share from the client or you can see it but can't access it or you can access the share but can't write to it.

It makes a difference since one is a network problem, one is a samba problem, and one is a Linux permissions problem. If you want help posting the output of the following commands would aid those trying to help you:

Code: Select all

smbtree

Code: Select all

testparm -s

Code: Select all

net usershare info --long

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 10:07 am
by GJQ
usbtux wrote:You should be able to brows the network,
Home Folder,
network, (bottom left)
Windows network (in my case) MSHOME, or WORKGROUP,
Then you should see connected computers,
Double click on the required computer and it'll ask for connection details, user, network ( mshome or workgroup) password.
Click ok and you should be able to connect to any shares you've already setup...

This may help http://forums.linuxmint.com/viewtopic.php?f=90&t=107272 setting up the shares :)
I did that but when I share the folder in my Home Directory, nothing happen.

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 10:09 am
by GJQ
altair4 wrote:
I have tried samba but it is not working.
Therefore read and write access is very important but I just can't get it set up working nicely.
If you are interested in diagnosing the problem with Samba let me know but you will need to be a wee bit more descriptive with your description of the problem. It's not clear from your post if you cannot see the share from the client or you can see it but can't access it or you can access the share but can't write to it.

It makes a difference since one is a network problem, one is a samba problem, and one is a Linux permissions problem. If you want help posting the output of the following commands would aid those trying to help you:

Code: Select all

smbtree

Code: Select all

testparm -s

Code: Select all

net usershare info --long
Thank you. I am really glad to see a reply like this. Got it. Working on it. Will post the outputs.

Thank you very much

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 10:16 am
by GJQ
Hi altair4,
Output for smbtree as below

asus@asus-1215B-1215B ~ $ smbtree
The program 'smbtree' is currently not installed. You can install it by typing:
sudo apt-get install smbclient
asus@asus-1215B-1215B ~ $ sudo apt-get install smbclient
[sudo] password for asus:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
cifs-utils
The following NEW packages will be installed:
smbclient
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 5,639 kB of archives.
After this operation, 42.3 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ quantal/main smbclient amd64 2:3.6.6-3ubuntu5 [5,639 kB]
Fetched 5,639 kB in 10s (514 kB/s)
Selecting previously unselected package smbclient.
(Reading database ... 159886 files and directories currently installed.)
Unpacking smbclient (from .../smbclient_2%3a3.6.6-3ubuntu5_amd64.deb) ...
Processing triggers for man-db ...
Setting up smbclient (2:3.6.6-3ubuntu5) ...
asus@asus-1215B-1215B ~ $ smbtree
Enter asus's password:
asus@asus-1215B-1215B ~ $ smbtree
Enter asus's password:
asus@asus-1215B-1215B ~ $ sudo -s
asus-1215B-1215B ~ # smbtree
Enter root's password:
asus-1215B-1215B ~ # exit
exit
asus@asus-1215B-1215B ~ $


Output for testparm -s
asus@asus-1215B-1215B ~ $ 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 "[Documents]"
Loaded services file OK.
Server role: ROLE_STANDALONE
[global]
workgroup = JINQUAN
server string = %h server (Samba, Ubuntu)
encrypt passwords = No
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* .
username map = /etc/samba/smbusers
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

[Documents]
path = /home/asus/Documents
read only = No
guest ok = Yes
asus@asus-1215B-1215B ~ $

Output for net usershare info --long as below:
asus@asus-1215B-1215B ~ $ net usershare info --long
asus@asus-1215B-1215B ~ $ sudo -s
asus-1215B-1215B ~ # net usershare info --long
asus-1215B-1215B ~ # exit
exit
asus@asus-1215B-1215B ~ $


Thank you for helping.

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 12:37 pm
by altair4
There's 3 things wrong with your output:
asus@asus-1215B-1215B
In Debian based systems Samba uses the hostname to create the netbios name that it broadcasts to the rest of the network. In your case it's invisible because it's too long. Rather than change the host name itself you can change the netbios name directly in smb.conf. See below.
encrypt passwords = No
Even though you created a guest share a password is being sent even though it's null so that needs to be fixed. See below.

To fix the above 2 items:

Edit smb.conf as root:

Code: Select all

gksu gedit /etc/samba/smb.conf
Right under the workgroup line add the following:

Code: Select all

netbios name = asus-1215B
While you are in there add another line:

Code: Select all

name resolve order = bcast host lmhosts wins
Then find the "encrypt password" line and change No to Yes:

Code: Select all

encrypt passwords = Yes
Save smb.conf and then restart samba:

Code: Select all

sudo service smbd restart
sudo service nmbd restart
But by far the most disturbing output was this:
asus@asus-1215B-1215B ~ $ smbtree
The program 'smbtree' is currently not installed. You can install it by typing:
sudo apt-get install smbclient
Different distros may or may not have the samba server package installed by default ( Mint does ) but as long as I have been using Linux not one of them has ever failed to install smbclient by default - not one.

Um ... I just wonder what else is missing from your install. Did yo by any chance install Samba4 by mistake?

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 1:25 pm
by GJQ
Hi,
I have amended as per your request. Pls check if I have put it at the correct locations. Details as below:

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

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = JINQUAN
netbios name = asus-1215B ----------- Added this in

####### Authentication #######

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
# security = user

# You may wish to use password encryption. See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
encrypt passwords = yes ----- ( This is the part change )


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

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = JINQUAN
netbios name = asus-1215B

# server string is the equivalent of the NT Description field
server string = %h server (Samba, Ubuntu)

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
# wins support = no

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; wins server = w.x.y.z

# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no

# What naming service and in what order should we use to resolve host names
# to IP addresses
; name resolve order = lmhosts host wins bcast ( Original Settings )
; name resolve order = bcast host lmhosts wins ( Change it as per your request )

Output for the code sudo service smbd restart and sudo service nmbd restart as below:
asus@asus-1215B-1215B ~ $ sudo -s
[sudo] password for asus:
asus-1215B-1215B ~ # gksu gedit /etc/samba/smb.conf
asus-1215B-1215B ~ # sudo service smbd restart
smbd: unrecognized service
asus-1215B-1215B ~ # sudo service nmbd restart
nmbd: unrecognized service
asus-1215B-1215B ~ #

Here is what install under Software Manager
python-smbc ( python bindings for samba clients (libsmbclient)
libwbclient0 (samba winbind client library)
samba-common (common files used by both samba server and client)
samba-common-bin ((common files used by both samba server and client

In Synaptic Package Manager
samba-common
samba-common-bin
python-smbc
libwbclient0
smbclient
libsmbclient

With regards to the below problem. Is there any solution to it or what should I do about it?
asus@asus-1215B-1215B ~ $ smbtree
The program 'smbtree' is currently not installed. You can install it by typing:
sudo apt-get install smbclient


Thank you

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 1:47 pm
by mintybits
GJQ wrote:Is there any other alternatives beside Samba?
Yes!
http://forums.linuxmint.com/viewtopic.p ... 96#p662096

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 2:16 pm
by altair4
GJQ wrote:# What naming service and in what order should we use to resolve host names
# to IP addresses
; name resolve order = lmhosts host wins bcast ( Original Settings )
; name resolve order = bcast host lmhosts wins ( Change it as per your request )
Remove the leading ";" from the line. It tells samba to ignore it. It should read:
name resolve order = bcast host lmhosts wins
asus-1215B-1215B ~ # sudo service smbd restart
smbd: unrecognized service
asus-1215B-1215B ~ # sudo service nmbd restart
nmbd: unrecognized service
What operating system are you using? You posted in the "Main Edition" section of the forum. Are you using Mint's LMDE variant? If you are then the command is:

Code: Select all

sudo service samba restart
If you truly are using the Main Edition try starting it instead:

Code: Select all

sudo service smbd start
sudo service nmbd start
As a side note why do you keep doing this:
sudo -s
As for this:
asus@asus-1215B-1215B ~ $ smbtree
The program 'smbtree' is currently not installed. You can install it by typing:
sudo apt-get install smbclient
If you installed smbclient and are still getting that error I have no explanation except a bad install.

Boot into you Install disk, open a terminal and type: smbtree. When it asks for mint's password just hit enter. It should work from the install disk without you even installing it. If it does then there is something wrong with your install, it's something you installed after the install, or an update that has messed up your system.

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 2:19 pm
by altair4
@mintybits, If you are going to recommend something or give advice make an effort to be accurate. This is the Mint forum not the Ubuntu forum:
mintybits wrote: If you are using linux on everything just use SSH. :D
On each PC install SSH

Code: Select all

sudo apt-get install ssh
I've given you the correct package in the the link. And I also gave a warning about it's use.

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 2:26 pm
by mintybits

Code: Select all

sudo apt-get install ssh
is correct.

Re: Linux Mint 14 File Sharing with read and write access

Posted: Thu Dec 20, 2012 2:52 pm
by altair4
mintybits wrote:

Code: Select all

sudo apt-get install ssh
is correct.
You are quite right. I do apologize for my mistake. My warning still applies however:
But, Just make sure you really and truly trust the user you allow access because you have just given him at a minimum read access to everything you own.
If you are the only user among all these machines it's not an issue. If not .....

Re: Linux Mint 14 File Sharing with read and write access

Posted: Fri Dec 21, 2012 7:38 am
by GJQ
mintybits wrote:
GJQ wrote:Is there any other alternatives beside Samba?
Yes!
http://forums.linuxmint.com/viewtopic.p ... 96#p662096
Hi mintybits,
I have tried ssh but it is not what I wanted. What I want is folder sharing over lan workgroup. That would be simple as folders will be shown on the lan network. Thanks for the suggestions, really appreciated it.

Re: Linux Mint 14 File Sharing with read and write access

Posted: Fri Dec 21, 2012 7:54 am
by GJQ
altair4 wrote:
GJQ wrote:# What naming service and in what order should we use to resolve host names
# to IP addresses
; name resolve order = lmhosts host wins bcast ( Original Settings )
; name resolve order = bcast host lmhosts wins ( Change it as per your request )
Remove the leading ";" from the line. It tells samba to ignore it. It should read:
name resolve order = bcast host lmhosts wins
Okay done as per your advise

asus-1215B-1215B ~ # sudo service smbd restart
smbd: unrecognized service
asus-1215B-1215B ~ # sudo service nmbd restart
nmbd: unrecognized service
What operating system are you using? You posted in the "Main Edition" section of the forum. Are you using Mint's LMDE variant? If you are then the command is:

Code: Select all

sudo service samba restart
If you truly are using the Main Edition try starting it instead:

Code: Select all

sudo service smbd start
sudo service nmbd start
No I am using the 64bit Linux Mint 14 Mate edition. Which code should I use?


As a side note why do you keep doing this:
sudo -s
During the smbclient installation, I put in the code but nothing happen so I though it could be root permission issues, therefore try to install it. Sorry I still learning linux although basic installation into the system is within my ability but not anything more.


As for this:
asus@asus-1215B-1215B ~ $ smbtree
The program 'smbtree' is currently not installed. You can install it by typing:
sudo apt-get install smbclient
If you installed smbclient and are still getting that error I have no explanation except a bad install.

Boot into you Install disk, open a terminal and type: smbtree. When it asks for mint's password just hit enter. It should work from the install disk without you even installing it. If it does then there is something wrong with your install, it's something you installed after the install, or an update that has messed up your system.

What do you mean by Boot into your Install disk? Is it to reinsert the CD with the software and try to set it up under Live CD condition to see if it work?


Thank you

Re: Linux Mint 14 File Sharing with read and write access

Posted: Fri Dec 21, 2012 8:06 am
by altair4
What do you mean by Boot into your Install disk? Is it to reinsert the CD with the software and try to set it up under Live CD condition to see if it work?
Yes. A Mint LiveCD has a fully functional Samba server and client. I am interested to find out if the command smbtree still fails in that mode. I just did this myself and it runs without errors and displays my lan hosts. You have so may things wrong with so many components of samba - the samba client, samba services, etc - that I'm trying to find out if the Install CD is the source of this problem or if it is something that was done after the install.

BTW, SSH will give you folder sharing across the LAN. As implemented above however it will not restrict the client user to /home/asus/Documents. The client will have at a minimum read access to your entire system. It depends on who the other users are on the lan.

Re: Linux Mint 14 File Sharing with read and write access

Posted: Fri Dec 21, 2012 10:28 am
by GJQ
Hi altair4
The laptop does not have a CDROM. Is there any way to try the solution using a Pendrive?

Thanks

Re: Linux Mint 14 File Sharing with read and write access

Posted: Fri Dec 21, 2012 12:49 pm
by altair4
Now that I should have thought about before suggesting it. I have no idea. All the laptops in this shop run OSX. Maybe someone else knows the answer but I do not.

I don't know what to tell you but you seem to be in a bad situation:

** Your system doesn't recognize the samba services: smbd nmbd
** When you try to run a low level samba client command ( smbtree ) it tells you smbclient isn't installed which is pretty much impossible.
** So you install it and when you run smbtree again it again tells you that smbclient isn't installed.

This problem transcends samba.

Forget samba. If ssh doesn't suit you then install TransferOnLan: http://code.google.com/p/transfer-on-lan/downloads/list
Transfer on LAN is a software that allows multiple users to transfer files (or folders) on a local network. It is cross-platform (it works with Java 6) and requires no configuration.

Transfer on LAN is a spiritual son of Giver.

Transfer on LAN uses TCP and UDP ports 2011 (be careful if you have a firewall activated).
Download to each laptop and expand it to a folder in your home directory. Have each user launch the application by double clicking TransferOnLan.sh file. THen drag and drop a file/folder from one machine to the other. Then receiver of the file is notified and has to accept it before transfer takes place.

This isn't file sharing in the Samba sense or even in the ssh sense but if the objective is to get a file from A to B it will work.

Re: Linux Mint 14 File Sharing with read and write access

Posted: Fri Dec 21, 2012 1:03 pm
by mintybits
GJQ wrote: Hi mintybits,
I have tried ssh but it is not what I wanted. What I want is folder sharing over lan workgroup. That would be simple as folders will be shown on the lan network. Thanks for the suggestions, really appreciated it.
Sure. Just for anyone else reading this thread, creating a secure share using SSH is quite easy. At least compared to Samba. I use Samba too, for sharing with Windows machines, and I always find it a struggle to set up.

The SSH server can simply be configured to confine a user or group member to a particular directory. This is called a chroot jail. For example, you could set up a restricted user on each server and give it the same name on all of them for convenience, say "guest". Then on each server you create a special directory for sharing, for example /srv/sftp-jail/guest. Then add a few lines to your /etc/sshd_conf file to tell SSH to restrict access to the guest user to that directory.

The SSH method, I think, is very secure and all transfers are encrypted. The inconveniences are having to know the server's IP address (at least the first time) and having to set up the guest user on the server. Also, unlike with Samba, you don't automatically get the network share showing up in your network graphical display.

So it depends what you need and how much pain you enjoy. On a small, linux-only network where the user accounts are properly set up and permissioned, I would likely choose SSH myself.

Re: Linux Mint 14 File Sharing with read and write access

Posted: Fri Dec 21, 2012 1:10 pm
by mintybits
NFS is another way to share stuff across a linux network. Also with Windows machines which, I believe, can run NFS. https://help.ubuntu.com/community/SettingUpNFSHowTo
I've used this some years back and it was very fast. Can't recall all the details but it may be simpler to set up than Samba and SSH; that link will explain all.