Page 1 of 4
Simply, Teaching Puppy to SAMBA (share folders to LAN users)
Posted: Sun 17 Oct 2010, 23:13
by gcmartin
Digressing for a moment to “level set
Posted: Mon 18 Oct 2010, 00:25
by plankenstein
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
Startup script
Posted: Sun 24 Oct 2010, 12:40
by shinobar
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:
- hostname: Edit the file '/etc/hostname', replace 'puppypc' to the machine name you decided like 'NewPuppy'.
- 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.
- 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
Samba with an NTFS USB Share
Posted: Fri 10 Dec 2010, 21:18
by kanehekili
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:
"[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: Select all
##
## 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?
Re: Samba with an NTFS USB Share
Posted: Sat 11 Dec 2010, 00:11
by shinobar
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
Posted: Sat 11 Dec 2010, 21:02
by kanehekili
Shinobar,
thanx for your time to help.
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.
Another trap may be the user 'nobody'. I recommend user 'spot' or 'ftp'.
So I will look into the users again
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.
Posted: Sat 11 Dec 2010, 21:38
by gcmartin
@kanehekili, Try this:
In a terminal window:
and in the
smb.conf resource
Code: Select all
[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.
Re: Samba with an NTFS USB Share
Posted: Sun 12 Dec 2010, 09:21
by shinobar
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:
"[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:
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...
Needs more investigation...
Posted: Sun 12 Dec 2010, 13:04
by rcrsn51
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.
Posted: Sun 12 Dec 2010, 14:39
by kanehekili
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: Select all
# 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
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...
Posted: Sun 12 Dec 2010, 14:45
by rcrsn51
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.
force user = root
Posted: Sun 12 Dec 2010, 15:13
by shinobar
kanehekili wrote:force user = root
Great!
I think it is most practical solusion.
Posted: Mon 13 Dec 2010, 17:03
by gcmartin
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.
Posted: Mon 13 Dec 2010, 18:06
by rcrsn51
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.
Posted: Mon 13 Dec 2010, 19:23
by gcmartin
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.
Posted: Tue 14 Dec 2010, 13:28
by rcrsn51
force user = root
This is a handy trick! It means that you can create non-privileged users with personal home directories on the server, who can also access a FAT/NTFS share by getting temporary root privilege.
You can control the amount of privilege in the share with "writable" or "read only".
Managing Users in SAMBA
Posted: Wed 15 Dec 2010, 23:13
by gcmartin
Yes, this allows user root to have that privilege; and any other users that I might have on the LAN, as well, for example
Code: Select all
force user = root,spot,Mom,Dad,Sister,ElderlyNeighbor,Me
Assuming those of the names those users use to logon to their Windows PCs.
Just a note for anyone interested: M$ charges an entry level $1000+ for the Basic Server which does this. IFF you use your search engine for "Linux SAMBA PDC" you will probably find 100 documents of others before us who have setup SAMBA to manage
ALL users on your network and what they can and cant see. Its really simple after you get past what we've just done here in "Teaching Puppy to SAMBA". Anyone's choice: $1000 or Open-Source..."What say you?"
Posted: Fri 08 Apr 2011, 16:43
by 8-bit
I am running Puppy Lupu 520 first of all as a frugal install.
I tried following your how to to get the initial settings done and then I tried the commands from a terminal pertaining to retstart.
I had samba-3.5.5-lucid.sfs loaded.
but the restart option was not recognized as a valid option.
Also, all drive and file access on my pc slowed up greatly.
I ended up recovering using a backup of my lupusave.2fs file I had previously made and then copying apps I had installed in wine drive c by removing drive_c and copying the one from the bad pupsave file.
So now, I am at a loss as to where to go from here.
Also, I should mention the the nested mkdir command did not work and I had to make each directory individually.
And smbd and nmbd were reported as not found.
I had to make links to them in /usr/bin to access them.
So simple was not so simple in my case.
there were some problems with the differing SFSs
Posted: Wed 13 Apr 2011, 23:36
by gcmartin
8-bit wrote:I am running Puppy Lupu 520 first of all as a frugal install.
I tried following your how to to get the initial settings done and then I tried the commands from a terminal pertaining to retstart.
I had samba-3.5.5-lucid.sfs loaded.
but the restart option was not recognized as a valid option.
Also, all drive and file access on my pc slowed up greatly.
I ended up recovering using a backup of my lupusave.2fs file I had previously made and then copying apps I had installed in wine drive c by removing drive_c and copying the one from the bad pupsave file.
So now, I am at a loss as to where to go from here.
Also, I should mention the the nested mkdir command did not work and I had to make each directory individually.
And smbd and nmbd were reported as not found.
I had to make links to them in /usr/bin to access them.
So simple was not so simple in my case.
So sorry that I just got this. Seems that there are several issues so I will attempt to address them individually.
Firstly, lets start with a nested Linux mkdir command. Would you try that first, and report back.
Next, there were problems with the SFSs files for 3.5.5. I'm not sure which of them you are using. One of them follows the directions, but the other was a sharp departure from the directions. And, for both, NEITHER are supported anymore by either author.
I am in the process of creating a new updated document for users wanted to simply add SAMBA to their non-SAMBA system. I, currently, am concentrating on the newer PUPs because those PUP distro owners have SAMBA available via PPM. This makes your use and a document more generic for all newer PUPs.
But, it you're willing, follow me and I may be able to help you without a manual. Firstly, let me ask this (I don't have a PUP520) "Live" media to boot from: Would you open your PPM and update it. Then exit the PPM and reopen it. Then click the All button in the left column. The large right column should populate. If it does, scan down that list for SAMBA. You will either see 3.4.x or 3.5.6 or 3.5.8. Which do you see?
Select it and report back here which you have (this is because some will update your Menu and the others WONT).
The next 2 things will be easy. PPM me when you hav e done this.
Thanks in advance.
Samba 3.5.6 on Lucid-Puppy 5.2.5
Posted: Sat 05 Nov 2011, 15:26
by mimmo
So the first thing for me was that "smbd -restart" did not work...
the solution came after a reboot as at this point I did have a samba running
and the disk of my shared directory was mounted
so I looked wher this guy was started
and the solution is in
/etc/init.d/smb
the options are: start|stop|restart|reload|status
#smb restart
works find (I see the changes on the windows side)
from windows I access the readme in the spot home dir
but I have problems to acces Photo
my smb.conf looks like this
Code: Select all
[Photo]
# the path should be readable and writable by the guest account
path = /mnt/sdb1/Photo
public = yes
only guest = yes
guest ok = Yes
writable = yes
printable = no
create mask = 0765
force group = spot
[spot]
path = /root/spot
public = yes
only guest = yes
guest ok = Yes
writable = yes
printable = no
create mask = 0765
force group = spot
I did the very same for Photo and spot ...
I have cheked that directory /mnt/sdb1/Photo is accessible to any one (respectively / 755 / 777 / 777 /)
what's wrong ? any idea