Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 30 Sep 2014, 09:55
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Network
Simply, Teaching Puppy to SAMBA (share folders to LAN users)
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 4 [57 Posts]   Goto page: 1, 2, 3, 4 Next
Author Message
gcmartin

Joined: 14 Oct 2005
Posts: 4288
Location: Earth

PostPosted: Sun 17 Oct 2010, 19:13    Post subject:  Simply, Teaching Puppy to SAMBA (share folders to LAN users)
Subject description: A Puppy-SAMBA server getting started experience
 

Digressing for a moment to “level set”, I begin by making this statement.
ALL MICROSOFT MACHINES COME STANDARD AS LAN SERVER MACHINES.
This means that they ALL have the ability to share stuff that they have with any other PC on the LAN. They are pre-built to work in a sharing community with other computers. When a machine has the ability to share something it has with its community, it is known as a “server”; so, whether you knew this or not, using Microsoft from Win95 to today, you have been running a server!”

Now that we understand this, we now know what I am referring to whenever you see the word “server”. The sole function of SAMBA is to allow your Puppy machine to implement sharing in a manner that you deem appropriate for how you want it to exist on your LAN. Now, that was a mouthful to simply say, SAMBA will let you share something on your LAN and SAMBA will go further by letting you MANAGE all kind of things on your LAN, beyond simply sharing something.

BTW: If you have a modern Puppy distro (2014) look at this thread for possible distro-unique information.

This thread for Puppy users is ONLY going to get you started; "simply and easily".
It intends to get you a base understanding of what you have to do to begin sharing stuff you have with your community. I will make my Puppy share stuff the same as what my Windows PCs have been doing with each other over the years. It is not intended to address security or advance use. Simply, a starting point for anyone new to using Linux, to share folders same as Microsoft.

Some of you may find this a little too English language or elementary. But, I do NOT intend to be overly technical here. This document is aimed at simple Windows users who knows very little Linux, yet, this document may be found to be useful to long time Linux users, as well.

Let’s dive right in by starting with a Requirements definition.
BTW: If you have a modern Puppy distro (2014) look at this thread for possible distro-unique information.
  • Requirement: I want to share a folder of stuff with everyone on my LAN. For starters, I do not need to add additional users on the Puppy server other than the one(s) that come with Puppy. Finally, I am ignoring any security concerns at this point of testing SAMBA on my Puppy PCs. This will be addressed in the future.
  • Assumption1: That you are using Puppy 5.1.1
  • Assumption2: That you have already installed SAMBA 3.5.5 from either a PET or from an SFS on your Puppy.
Before starting our operation, there is 4 items of information that you must have answers to before beginning. Two of them are already answered for you and the other 2 YOU MUST DECIDE. My references here are mine and you should decide your own.

One Already Answered
The one that is already answered is the Workgroup name. Assuming you are on a LAN with Microsoft machines, they are “probably” all in the same workgroup. If not, you should put them in the same workgroup before starting this experience. Lets assume you/someone has changed Microsoft’s default workgroup name to “UseAWindowsGroup”. The workgroup name I will use for this example will be that very same name as the Windows PCs, namely “UseAWindowsGroup” for this Puppy SAMBA server to belong to.

Another Already Answered
Your Puppy 5.1.1 username and password is “root” and “woofwoof”

What are the other 2 YOU MUST DECIDE
  1. YOU must decide what the name you want your PC to be known as, on your LAN.
  2. And, YOU must decide what you want to share.
    I want this PC to be known to all the other machines as “NewPuppy” and I want to share a folder on this system named “Downloads”.
Open a Terminal Window on your Puppy
To make these things happen, we must start a terminal session by clicking “Console” on the Puppy desktop. (Another way to open a console from your desktop is to click Menu > Utility > click the item that says “terminal emulator” or “console”.
I will use the 4 items in reverse order. So first, I will create the Downloads folder that I want to share and set its rights so that everyone can see it and write to it.
Code:
# mkdir /srv/Downloads
# chmod 1766 /srv/Downloads
Next, since I want everyone on the LAN to know this PC’s name as NewPuppy, I need to tell Linux to set that to be my hostname. (By the way, EVERY LAN machine needs a unique hostname. Therefore, for example, you should NEVER have 2 machines whose name is "puppypc")
Code:
# hostname NewPuppy
Install SAMBA on your Puppy
I am assuming that you have either already install the SAMBA SFS or, if using the LiveCD like me, you have installed the SAMBA PET(Using LiveCD; if you installed the PET, DO NOT REBOOT. There is no need to reboot to begin sharing stuff using SAMBA).

Configure SAMBA for a simple test
SAMBA requires a configuration file. To get SAMBA to do what I want it to do, I will do 2 things: I will tell it what to do via its configuration file. Then I will run a test program to check if I made errors in telling it what to do.
SAMBA has one and ONLY one configuration file for EVERYTHING. It is the smb.conf and on my Puppy system, this is found in /etc/opt/samba/smb.conf. We are going to backup the one that’s there, create our own, and test it.
Code:
# mv  /etc/opt/samba/smb.conf  /etc/opt/samba/smb.conf.1st.backup
# leafpad /etc/opt/samba/smb.conf

(Enter or type the following 12 lines into the screen and save it)

# All SAMBA configurations have a global piece AND it has piece(s) called shares
# Global Parameters describes this PC’s behavior, overall.
[global]
workgroup = UseAWindowsGroup
server string = %h is a NAS (Test)

# Sharing Parameters tell what items this PC shares out to the LAN
[Downloads]
path = /srv/Downloads
comment = A Central Download folder for all to use
writeable = true
guest ok = Yes
(NOW SAVE THIS!)

Next, lets test it for errors.
Code:
# testparm
You will know if you had errors.

Otherwise, we are now ready to put SAMBA to work. Let’s do it:
Code:
# smbd restart
# nmbd restart
Your Puppy is now sharing the “/Download” with anyone who wants to use it on your LAN.

Let’s add an empty file into that Download folder
Code:
# touch /srv/Downloads/test-file.txt
Final step: Tell SAMBA you are a valid SAMBA user
This is done via SAMBA tool, smbpasswd. For MY Puppy system I will tell SAMBA to add a user named root and I will give it the same password as I use in Puppy....woofwoof. This is done in the terminal window by typing:
Code:
# smbpasswd -L -a root
You can, now, go to ANY Windows PC’s desktop and see your NewPuppy on your LAN. On Windows, open your My Network Places and you will find your SAMBA Puppy there with the name NewPuppy. And if you double-click it, you will see the “test-file.txt” file we put there.

As I said earlier, these are my names that were used. You should choose names that you like for your Puppy PC that is going to share information with the LAN community.

Personally, I’ve done this kind of thing with each Puppy I run on my LAN; i.e. install SAMBA on each with unique hostnames. Now, all of my Puppies can share and use stuff, same as all my Windows PCs can.

You (and I) have met the original requirement. Congratulations....WOOF WOOF!

To recap:
  • The Windows Workgroup that my Puppy joined is “UseAWindowsGroup”
  • My Puppy PCs name is “NewPuppy"
  • The folder I want to share with my LAN community “/Download”
  • My valid Puppy SAMBA username is “root” and password is “woofwoof”
  • We told SAMBA using the above items ‘what to do for this PC’.
Note1: While on any other LAN PC and trying to connect to this Puppy, I always give the username root and the password woofwoof.
Note2: This example uses /srv/Downloads because, according to the Filesystem Hierarchy Standard (FHS), “/srv” is where site-specific data should be served. Technically Samba shares can be placed anywhere on the filesystem as long as the permissions are correct, but adhering to standards is recommended.

BTW: If you have a modern Puppy distro (2014) look at this thread for possible distro-unique information.

(Thanks goes out to Mobeus for the contribution that he made while under a severe time-crunch and pressure from his full-time job. He has been the inspiration as he saw the need and helped all of us by addressing it. And also to Shinobar, for his work as well, for addressing this need for all of us.)

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engine or use DogPile

Last edited by gcmartin on Wed 18 Jun 2014, 20:32; edited 9 times in total
Back to top
View user's profile Send private message 
plankenstein


Joined: 15 Nov 2008
Posts: 121
Location: Arkansas, USA

PostPosted: Sun 17 Oct 2010, 20:25    Post subject:  

Excelent tutorial gcmartin! This was about as strait forward and simple as it can get. Even a noob like me was able to follow this and when I get home later I'm going to give it a try.

Thanks Very Happy

_________________
I carefully plan ALL my random acts! Laughing
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Sun 24 Oct 2010, 08:40    Post subject: Startup script  

Great, gcmartin.
Hope this document helps pupians.

I like to add a tip to start up samba automatically at the booting up Puppy.
Three points:
  1. hostname: Edit the file '/etc/hostname', replace 'puppypc' to the machine name you decided like 'NewPuppy'.
  2. Startup script: Place some script to start up samba in the directory '/etc/init.d'. Say the name '/etc/init.d/smb'.
    It is called as 'smb start' at the Puppy boots up, and called as 'smb stop' at Puppy shutdown.
  3. Mounting partition: Make some mounting measure if the shared path is under /mnt other than /mnt/home.
    You can write the mounting command like 'mount /dev/sdb1 /mnt/sdb1' in '/etc/rc.d/rc.local' or in the script /etc/init.d/smb'

My SFS, samba-3.5.5-lucid.sfs (Use samba-3.0.26-3-{sfs4,sfs3}.sfs for Puppy 4.x.), has the script '/etc/init.d/smb'(attached) for the above 2-3 sake. The scripts reads the configuration file '/etc/opt/samba/smb.conf', and auto-mount the partition shared.

Notice: the shared path should be readable/writable from the samba user. If you set it as 'root', as gcmartin wrote on the top article, you need not care of.
But the smb.conf.example in my SFS is the user 'spot' as the default. Sharing /root/spot is no problem.
http://www.murga-linux.com/puppy/viewtopic.php?t=60836
smb.gz
Description  A sample of the start up script, '/etc/init.d/smb'.
You need not this if you use my SFS, samba-3.5.5-lucid.sfs or samba-3.0.26-3-{sfs4,sfs3}.sfs.
Modification required if you use this for another buils of PET or SFS.
gz

 Download 
Filename  smb.gz 
Filesize  946 Bytes 
Downloaded  1201 Time(s) 

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
kanehekili

Joined: 07 Nov 2010
Posts: 6
Location: Bavarian alps, Frugal Puppy 5.2 & Thinkpad A22e 256 MB 20 GB/750GB Ultrabay SATA Adapter

PostPosted: Fri 10 Dec 2010, 17:18    Post subject: Samba with an NTFS USB Share
Subject description: A question concerning Samba and NTFS
 

First of all I would like to thank you for this great guide. With it I could set up Samba 3.5.5 with shinobars and gcmartins explanations without much fuzz! But one thing I couldn't figure out (I'm using Puppy 5.1.1):
A mounted NTFS USB drive (sdb1) cannot be accessed by either an Ubuntu (Lucid) or Windows (XP) computer, which are in the same subnet. If I attach a FAT32 USB drive, everything is fine.
The corresponding log shows:
Quote:
"[2010/12/10 18:57:06.977049, 0] smbd/service.c:988(make_connection_snum)
canonicalize_connect_path failed for service schmakmu, path /mnt/sdb1"


I tried to find any answer in the net, so this is my last resort.

Below parts of my smb.conf

Code:
##
## Basic Server Settings
##
   public = Yes
   # workgroup = NT-Domain-Name or Workgroup-Name, eg: REDHAT4
   workgroup = WESTENDNET1

   # server string is the equivalent of the NT Description field
   server string = Samba Server on Puppy

   #BK think need to change this...
   log file = /var/log/samba/log.%m
   # Put a capping on the size of the log files (in Kb).
   max log size = 50

   # Security mode.
   ;security = user
   security = share
   ;map to guest = Bad User
   null passwords = Yes
   guest account = nobody
   ;create mask = 0644
   ;directory mask = 0755
...
[schmakmu]
   path = /mnt/sdb1
   ;force user =  nobody
   ;force group = nobody
   read only = no
   ;public = yes
   ;guest only = yes
   ;guest ok = Yes
   ;writable = yes
   create mask = 0765


I activated/deactived most of the parameters seen in the "schmakmu" section, but to no avail.
Anybody got an idea?
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Fri 10 Dec 2010, 20:11    Post subject: Re: Samba with an NTFS USB Share
Subject description: A question concerning Samba and NTFS
 

kanehekili wrote:
# Security mode.
;security = user
security = share
;map to guest = Bad User
null passwords = Yes
guest account = nobody
;create mask = 0644
;directory mask = 0755

The shared storage should be both readable and writable by the user.
As for the Windows partitions(ntfs/vfat), it should be mounted with the owner is the user.
The script /etc/init.d/smb does it automatically.
A trap is the partition are better to be mounted by this script, means it should not be mounted before. So you cannot boot up Puppy from the shared (ntfs or vfat) partition because it is owned by 'root' in the case.
Another trap may be the user 'nobody'. I recommend user 'spot' or 'ftp'.

The script /etc/init.d/smb is already in my sfs. Also the/etc/opt/samba/smb.conf.example can be a help.
BTW, Are you sure you are using samba-3.5.5-lucid-1.sfs?
http://www.murga-linux.com/puppy/viewtopic.php?t=60836

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
kanehekili

Joined: 07 Nov 2010
Posts: 6
Location: Bavarian alps, Frugal Puppy 5.2 & Thinkpad A22e 256 MB 20 GB/750GB Ultrabay SATA Adapter

PostPosted: Sat 11 Dec 2010, 17:02    Post subject:  

Shinobar,
thanx for your time to help.
Quote:
The shared storage should be both readable and writable by the user.
As for the Windows partitions(ntfs/vfat), it should be mounted with the owner is the user.

It is readable/writable, when looking at the flags. I'm using your script for mounting- so when puppy started, (and samba as well) the sdb1 drive is mounted by your script.
I intend to use that drive for data, not for puppy.
Quote:
Another trap may be the user 'nobody'. I recommend user 'spot' or 'ftp'.

So I will look into the users again Smile
Quote:
BTW, Are you sure you are using samba-3.5.5-lucid-1.sfs?

Yes, I'm positive, since I do have a frugal installation, your sfs file is mounted in /mnt as
+mnt+home+samba-3.5.5-lucid-1.sfs
I'll fiddle around some more- but even if I don't get it running with that specific drive - (my Fat32 USB drive works perfectly with Samba) - I'm very pleased with the Samba Pet.
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 4288
Location: Earth

PostPosted: Sat 11 Dec 2010, 17:38    Post subject:  

@kanehekili, Try this:
In a terminal window:
Code:
chmod 1777 /mnt/sdb1
and in the smb.conf resource
Code:
[schmakmu]
   path = /mnt/sdb1
   ...
   ...
   force create mode = 764
   force directory mode = 775
   ...
P.S. Question: What Puppy distro did you install your SAMBA to? Thx.
_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engine or use DogPile
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Sun 12 Dec 2010, 05:21    Post subject: Re: Samba with an NTFS USB Share
Subject description: A question concerning Samba and NTFS
 

kanehekili wrote:
A mounted NTFS USB drive (sdb1) cannot be accessed by either an Ubuntu (Lucid) or Windows (XP) computer, which are in the same subnet. If I attach a FAT32 USB drive, everything is fine.
The corresponding log shows:
Quote:
"[2010/12/10 18:57:06.977049, 0] smbd/service.c:988(make_connection_snum)
canonicalize_connect_path failed for service schmakmu, path /mnt/sdb1"

Confirmed. Seems ntfs permission problem.
It may be complex.

I tried with editing the mount script, /etc/init.d/smb at line 41:
Quote:
mount-FULL $MOUNTOPT -t $FS /dev/$PART /mnt/$PART

(Replaced 'mount' with 'mount-FULL'.)
Then i could read the NTFS shared, but couldn't write... Sad

Needs more investigation...Rolling Eyes

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
rcrsn51


Joined: 05 Sep 2006
Posts: 9143
Location: Stratford, Ontario

PostPosted: Sun 12 Dec 2010, 09:04    Post subject:  

I looked at this in Samba-TNG and got the same result. Here is a test situation independent of Samba.

1. I mount an NTFS partition as usual by clicking on its drive icon.

2. I open a terminal window and login as an unprivileged user.

3. I then try to access the mount point. It's not even recognized as a directory!

So if I start the samba server and use the NTFS drive as a share, then an unprivileged samba client won't be able to see it either. However a client logging in as "root" gets full rights to the share.

I suspect that this a result of how the ntfs-3g driver mounts the share. There may be some convoluted way of using ntfs-3g that solves the problem for unprivileged users.
Back to top
View user's profile Send private message 
kanehekili

Joined: 07 Nov 2010
Posts: 6
Location: Bavarian alps, Frugal Puppy 5.2 & Thinkpad A22e 256 MB 20 GB/750GB Ultrabay SATA Adapter

PostPosted: Sun 12 Dec 2010, 10:39    Post subject:
Subject description: NTFS on USB drive - found a solution
 

Well, I guess I found a way to access my drive now.
After I tried the variations of gcmartin and shinobar, with no success I came up with the following solution :


Code:

# Security mode.
security = share
null passwords = Yes
guest account = spot


[schmakmu]
   path = /mnt/sdb1
   force user =  root
   read only = no
   force create mode = 764
   force directory mode = 775
   create mask = 0765

So I used the advices of shinobar and gcmartin but the final solution was the line
Quote:
force user = root

I could copy and remove data to the drive without any problems. I dimly remember that I have read something about NTFS and linux and problems due to security...
Now I'm not really sure if I compromise my system by allowing everyone to become root... Confused
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9143
Location: Stratford, Ontario

PostPosted: Sun 12 Dec 2010, 10:45    Post subject:
Subject description: NTFS on USB drive - found a solution
 

kanehekili wrote:
Now I'm not really sure if I compromise my system by allowing everyone to become root... :?

What is the difference between logging into a share as a non-privileged user with full rights to the data versus logging in as root?

It's not like you are giving the user root access to the whole server. If you are concerned about the safety of the data, just put a "read only" restriction on the share.

Logging into a Samba server as root is less dangerous than running Puppy as root.
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Sun 12 Dec 2010, 11:13    Post subject: force user = root
Subject description: NTFS on USB drive - found a solution
 

kanehekili wrote:
force user = root

Great!
I think it is most practical solusion. Wink

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
gcmartin

Joined: 14 Oct 2005
Posts: 4288
Location: Earth

PostPosted: Mon 13 Dec 2010, 13:03    Post subject:  

kanehekili wrote:
Now I'm not really sure if I compromise my system by allowing everyone to become root..
In this example, as you show, you have told SAMBA that for this share [schmakmu], to let a user named "root" to have access to it. In other words, you have given ONLY the root SAMBA user the priviledge to ONLY this share....not to your Linux system. SAMBA did what you told it to; and he did not and will not go beyond what you told him.

Another important thing to remember is SAMBA users are separate users from Linux system users. So, if you want /need, you can create additional SAMBA users and also give those IDs access to this share as well. That way, by looking thru the SAMBA log, you can see which LAN user accessed this share and when.

Hope this helps.
Any other concerns, post them and we'll help.

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engine or use DogPile
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9143
Location: Stratford, Ontario

PostPosted: Mon 13 Dec 2010, 14:06    Post subject:  

Quote:
Another important thing to remember is SAMBA users are separate users from Linux system users. So, if you want /need, you can create additional SAMBA users and also give those IDs access to this share as well. That way, by looking thru the SAMBA log, you can see which LAN user accessed this share and when.

Could you confirm this? It's been my experience that a username must already exist as a Linux user before it can be created as a Samba user. Otherwise, the server won't know whether the user has the requisite privileges to access a share.
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 4288
Location: Earth

PostPosted: Mon 13 Dec 2010, 15:23    Post subject:  

rcrsn51 wrote:
Could you confirm this? It's been my experience that a username must already exist as a Linux user before it can be created as a Samba user. Otherwise, the server won't know whether the user has the requisite privileges to access a share.
in Linux, full SAMBA as I have created the smb.conf where there is NO LDAP server or PDC (and version 4 full SAMBA with AD), SAMBA authentication does NOT require ANY comparative Linux user. Always has been this way as far as I remember.

Hope this helps.
P.S. I haven't tested this in Puppy, though, but it should be the same.

Edited: I believe I withdraw my comments about SAMBA users and Linux users. Although I seem to remember the user systems as being distinct, it appears that there IS A RELATIONSHIP which @Rcrsn51 more accurately references...thanks

See this document for a VERY GOOD EXPLANATION on SAMBA USERS. There are many many other useful SAMBA documents on the internet as well.

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engine or use DogPile
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 4 [57 Posts]   Goto page: 1, 2, 3, 4 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Network
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1410s ][ Queries: 13 (0.0062s) ][ GZIP on ]