How to Get Samba Server Working in Puppy 4

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
vtpup
Posts: 1420
Joined: Thu 16 Oct 2008, 01:42
Location: Republic of Vermont
Contact:

How to Get Samba Server Working in Puppy 4

#1 Post by vtpup »

The Official Samba 3.0.26 .pet needs a little additional set-up work to get it starting (and stopping) on a Puppy 4 system.

Here's how:

1.) Install the server .pet with the Puppy Package Manager from the official repository.

2.) To get the smbd and nmbd commands properly in the Path, you can edit the /etc/profile file as follows:

Open it in Geany and do a find (Ctrl - F) for the word "samba". It should bring you to the following stanza:

Code: Select all

if [ -d /opt/samba ];then
 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/samba/lib"
 PATH="$PATH:/opt/samba/bin"
fi
Change The third line so you get the following:

Code: Select all

if [ -d /opt/samba ];then
 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/samba/lib"
 PATH="$PATH:/opt/samba/bin:/opt/samba/sbin"
fi
After saving the file and re-starting your computer, if you type smbd -D and nmbd -D in a terminal they should run

3.) to get Samba server to start, stop, and restart on command you can create the following file, /etc/rc.d/rc.samba:

Code: Select all

#!/bin/sh
#
# /etc/rc.d/rc.samba
#
# Start/stop/restart the Samba SMB file/print server.
#
# To make Samba start automatically at boot, make this
# file executable:  chmod 755 /etc/rc.d/rc.samba
#

samba_start() {
  if [ -x /opt/samba/sbin/smbd -a -x /opt/samba/sbin/nmbd -a -r /etc/opt/samba/smb.conf ]; then
    echo "Starting Samba..."
    /opt/samba/sbin/nmbd -D
    /opt/samba/sbin/smbd -D
    
  fi
}

samba_stop() {
  killall smbd nmbd
}

samba_restart() {
  samba_stop
  sleep 2
  samba_start
}

case "$1" in
'start')
  samba_start
  ;;
'stop')
  samba_stop
  ;;
'restart')
  samba_restart
  ;;
*)
  # Default is "start", for backwards compatibility with previous
  # Slackware versions.  This may change to a 'usage' error someday.
  samba_start
esac
After saving that, set the file permission to executable

Code: Select all

chmod 755 /etc/rc.d/rc.samba
and re-boot.

Now, typing the following into the console should start the server:

Code: Select all

/etc/rc.d/rc.samba start
Stop the server:

Code: Select all

/etc/rc.d/rc.samba stop
And do a stop and a restart:

Code: Select all

/etc/rc.d/rc.samba restart
You should also get a bit of status feedback for these, not just an empty command prompt.

4.) I won't go into creating a Samba configuration file, as that is well covered in How-to's all over the internet -- everybody has their own take on that. What I would suggest is that you make it easier to modify your samba configuration file by installing a program that was recently removed from Puppy, GTKSamba

Also please note, your smb.conf file will be located in /etc/opt/samba -- don't forget the "/opt"

To install GTKSamba, open your Puppy Package Manager and pick the Puppy 3 repository (not the Puppy 4) and install GTKSamba and the GTK+ packages. Don't worry about the missing library error messages when first installing GTKSamba -- they will be added automatically with the GTK+ package.

5.) After installing and rebooting, open GTKSamba and go to File and pick Preferences and on the Local tab, set the Samba Configuration File entry to /etc/opt/samba/smb.conf and the Samba Restart Command to /etc/rc.d/rc.samba restart

6.) Once you have created and edited your samba configuration file, you may want to add Samba users and passwords (they should be the same as on your Windows boxes, if you have them). Note -- even though Puppy operates from the Root user, you can still add Samba users with a simple:

Code: Select all

smbpasswd -a george
for a username of george. This doesn't affect Puppy in any way and doesn't add a home directory for George -- it just creates a Samba user with that name and password.

7.) To test your system, after starting the server, you can simply open Pnethood on your same machine, and it should pick up the server and shares.

Well, that's it. Hope this helps.
Last edited by vtpup on Thu 01 Jan 2009, 02:04, edited 2 times in total.

LaneLester
Posts: 209
Joined: Mon 15 Sep 2008, 01:14
Location: Rural Georgia, USA

Re: How to Get Samba Server Working in Puppy 4

#2 Post by LaneLester »

vtpup wrote:The Official Samba 3.0.26 .pet needs a little additional set-up work to get it starting (and stopping) on a Puppy 4 system.
Thank you for explaining in such good detail. If I'm ever able to use Puppy for "real" work, this will be one of my needs.

Frankly, I would have thought that accessing a Windows printer on one's LAN would be a common enough need that this would be easier. But maybe not.

Since my idea of "a little additional set-up work" differs from yours, I won't try this until I'm able to run WeatherDisplay in Puppy. That's for my outdoor weather station, something I want to be able to watch, no matter which OS I'm running.

Lane

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#3 Post by disciple »

A samba server has nothing to do with being able to print to a shared Windows printer. Which is a good point - why on earth is cups still not set up for the smb backend in 4.1.1?

Anyway, the solution is at http://www.murga-linux.com/puppy/viewto ... 125#197562
- you just need to create a link for the backend, and then restart CUPS.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#4 Post by rcrsn51 »

The complete How-To is here. Unfortunately, Samba printing over a wireless network still seems to be hit-and-miss in Puppy.

User avatar
vtpup
Posts: 1420
Joined: Thu 16 Oct 2008, 01:42
Location: Republic of Vermont
Contact:

#5 Post by vtpup »

My intent here was to show how to get Samba Server running in Puppy 4. That was a problem, previously with this .pet release in Pup4.

What to do with it is another matter. Samba erver configuration is a huge topic with many different setups and possible solutions to individual problems. But I hope that will be in a separate thread (or threads) devoted to those topics.

LaneLester
Posts: 209
Joined: Mon 15 Sep 2008, 01:14
Location: Rural Georgia, USA

#6 Post by LaneLester »

rcrsn51 wrote:The complete How-To is here. Unfortunately, Samba printing over a wireless network still seems to be hit-and-miss in Puppy.
Nuts! I followed the how-to, but no test page came through. OTOH, I also set up my network printer with the params that have always worked with other distros, and it didn't print, either.... and it's a wired connection between my computer and the network printer.

Lane

PaulBx1
Posts: 2312
Joined: Sat 17 Jun 2006, 03:11
Location: Wyoming, USA

#7 Post by PaulBx1 »

According to the Samba official howto, the nmbd daemon needs to be started before the smdb daemon. So the script shown above ought to be modified. Maybe it works as is for your machine, but it might be more reliable generally if rearranged.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#8 Post by rcrsn51 »

disciple wrote: Which is a good point - why on earth is cups still not set up for the smb backend in 4.1.1?
Maybe because Puppy has never used a formal bug tracking system? This problem WAS identified in the 4.00 Beta bug reports.

User avatar
vtpup
Posts: 1420
Joined: Thu 16 Oct 2008, 01:42
Location: Republic of Vermont
Contact:

#9 Post by vtpup »

Edited script to start nmbd befor smdb.

tbuff2
Posts: 8
Joined: Wed 31 Dec 2008, 17:52
Location: Georgia, USA

#10 Post by tbuff2 »

I've followed all the instructions in this thread and can start smb and nmbd from a terminal, but cannot get them to start on boot-up or when I execute /etc/rc.d/rc.samba command (looking at "top" to see if they're running). I've made the rc.samba file executable and re-booted, but that didn't help. I don't mind manually starting them, but this way sounds a lot easier. Any help would be appreciated.

User avatar
vtpup
Posts: 1420
Joined: Thu 16 Oct 2008, 01:42
Location: Republic of Vermont
Contact:

#11 Post by vtpup »

To start the server automatically, open /etc/rc.d/rc.local in Geany and add the line:

Code: Select all

/etc/rc.d/rc.samba start

tbuff2
Posts: 8
Joined: Wed 31 Dec 2008, 17:52
Location: Georgia, USA

#12 Post by tbuff2 »

Thanks!!! :D

That did the trick. I also found that my smb.conf file was in /etc/opt/samba so I had to make that change in the script. Works like a charm now.

Thanks again.

User avatar
vtpup
Posts: 1420
Joined: Thu 16 Oct 2008, 01:42
Location: Republic of Vermont
Contact:

#13 Post by vtpup »

You're welcome.

And thanks for the catch. I must have had a smb.conf in /etc as well from earlier install attempts, so it didn't fail for me when I tested it.

Script edited to include /etc/opt/ subdirectory.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

Can't get write access

#14 Post by jrb »

Hi,
I have installed samba-3.0.26.pet on puppy412 and followed the setup instructions in this thread, but I have only been able to get read access to my server.

I have made several attempts at smb.conf, modifying the original, copying from various websites but so far no write access.

Can someone post a smb.conf that will give me full read/write access to the /mnt directory of my server for all users?

Thanks, jrb

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#15 Post by jrb »

Have come up with a workable solution using:

Code: Select all

# Global parameters
[global]
       workgroup = Workgroup
       netbios name = Server2
       server string = Samba Server %v
       map to guest = Bad User
       log file = /var/log/samba/log.%m
       max log size = 50
       socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
       preferred master = No
       local master = No
       dns proxy = No
       security = share

# Share
   [public]
   comment = root access
   path = /mnt
   valid users = root
   public = yes
   writable = yes
   printable = no
Turns out the samba user must be also added as puppy user. Tried a few different users without success then tried registering root as samba user and was able to get read/write access.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#16 Post by jrb »

I have incorportated Vtpups great setup tips into ch-samba-3.0.26.sfs available here.

Should work on any puppy4.xx. It shares / (everything) at when samba is started. I put a samba controls entry on the network menu which opens a gui for starting, stopping, restarting and editing smb.conf.

Cheers, J

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#17 Post by Dougal »

Just a little comment: the rc.samba file should go in /etc/init.d. That way there is no need to start it from rc.local (it will be started automatically by rc.services).
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

Cthippo
Posts: 8
Joined: Wed 25 Nov 2009, 22:47

#18 Post by Cthippo »

6.) Once you have created and edited your samba configuration file, you may want to add Samba users and passwords (they should be the same as on your Windows boxes, if you have them). Note -- even though Puppy operates from the Root user, you can still add Samba users with a simple:

Code: Select all

smbpasswd -a george
I was doing reasonably well up to this point, but when I tried to set up a user I got this:

Code: Select all

# smbpasswd -a Chris
New SMB password:
Retype new SMB password:
Failed to modify password entry for user Chris
What am I missing here?

[/code]

whatshisname
Posts: 22
Joined: Mon 12 May 2008, 00:34

#19 Post by whatshisname »

Cthippo wrote:6.) Once you have created and edited your samba configuration file, you may want to add Samba users and passwords (they should be the same as on your Windows boxes, if you have them). Note -- even though Puppy operates from the Root user, you can still add Samba users with a simple:

Code: Select all

smbpasswd -a george
I was doing reasonably well up to this point, but when I tried to set up a user I got this:

Code: Select all

# smbpasswd -a Chris
New SMB password:
Retype new SMB password:
Failed to modify password entry for user Chris
What am I missing here?

[/code]
Just finished doing this on my machine.

According to the man file, the user must already be in "/etc/passwd". Before I found the instructions above for smbpasswd, I had tried adding my samba user to the system but my login failed. Read a little further and found the instructions for adding the user using smbpasswd and I was able to log in just fine.

So ...

Add a regular user to your system with: adduser sambausername

Then try adding your user again with smbpasswd.

Hope this helps.

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#20 Post by ecomoney »

Ive been banging my head against this for the last four hours!!! I think this is a great case for a package that "just works". :D

Anyway, once I get this working I would be willing to put in the time to make a new package with all of the required extra libraries (gtk+ etc) and the config files for puppy 4. This would be particularly useful for people Linuxing the many viruzed XP machines that will no longer start, as they could liveboot puppy and transfer the users files off before (hopefully) installing linux!!! :D

Heres where I am so far...

Ive installed the samba package from here

http://distro.ibiblio.org/pub/linux/dis ... 3.0.26.pet

and made the modifications to the /etc/profile script, and created the /etc/rc.d/rc.samba script. This starts/stops/restarts the samba process as I can see using "top" or pprocess.

My problem I think stems from the smb.conf file. If I had the COMPLETE file than perhaps I could be sure. Ive tried various example scripts from the web but they would be unintelligeable without several days study. What would be great is a generic, low security, smb.conf where I could simply enter in the path of the folder I wanted to share, and what it would be advertised as over the network when detected with pnethood.

Perhaps JRB, the full config file is in the samba .sfs you made for choicepup? Would extracting this file to my standard puppy 4.2.1 setup make it "just work"? Hopefully so! :roll:
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

Post Reply