chiriones
April 18th, 2004, 11:49
I'm running 4.7 on a home network with a router to cable modem.

Being unaware of the 'start' and 'stop' arguments I made a one-line script to start the smbclient, named smbclient.sh, made it executable, and stuck it in /usr/local/etc/rc.d:

smbclient -L piii -U steve -N

I forget the message at boot, but it never did start. I shut down and restarted. Now smbd won't start. In the samba log file for smbd it says:

[2004/04/18 11:24:15, 0] lib/util_sock.c:open_socket_in(804)
bind failed on port 139 socket_addr = 0.0.0.0.
Error = Address already in use

How do I get smbd to start again? How should I properly write the script to start smbclient?

Thanks,
Steve

Kernel_Killer
April 18th, 2004, 12:11
Is your host IP set to 0.0.0.0 in the smb.conf? If so, change it to the IP set on your host. See if that helps any.

chiriones
April 18th, 2004, 13:20
That worked!

This pc connects to the router via dhcp. I uncommented a line in smb.conf that said:

hosts allow = 192.168.1. 192.168.2 127.

I was able to start the smbd daemon and to successfully run smbclient. I rebooted and smbd started fine.

Whew! One step forward again. Thanks.

Any suggestions for a script to start smbclient at boot time? There are a couple of pages about startup scripts in the book Absolute BSD and I only understand the syntax partially. How about:

#--script begin
case "$1" in
start)
smbclient -L piii -U steve -N
;;
stop)
killall smbclient
;;
#--script end

Would that suffice?

bsdjunkie
April 18th, 2004, 16:09
It can be as simple as a script like this in your /etc/rc.local:

[code:1:f2097c5393]if [ -x /usr/local/sbin/daemonx ]; then
echo -n ' daemonx'; /usr/local/sbin/daemonx
fi[/code:1:f2097c5393]

Strog
April 19th, 2004, 09:49
If you are just trying trying automount a smb share at bootup then you can use fstab to mount it. You can put a .nsmbrc file in root's directory for the username/password (you won't need this if guest is enabled on the smb server). You can find the examples to set it up in /usr/share/examples/smbfs/dot.nsmbrc. Regular users can use this too as long as they have permissions to mount a share in the first place.

Here's the gist of it.
[code:1:5f7d10d1fb]
[SERVER:USER:SHARE]
addr=192.168.0.1
password=mypass
workgroup=WORKGROUP

[SERVER:USER:ANOTHERSHARE]
addr=192.168.0.1
password=mypass
workgroup=WORKGROUP
[/code:1:5f7d10d1fb]

I looked into this option when I was trying to connect some OS X clients to a samba server. I realized that I could use Netinfo instead but that won't help you for this. :roll:

chiriones
April 20th, 2004, 02:49
Well, I think that worked.

I copied /usr/share/examples/etc/nsmb.conf to /usr/local/etc/nsmb.conf instead of using .nsmbrc in one of the home directories so it would mount no matter what user was logged in (right now it's just me and my friend root.)

I modified nsmb.conf with these lines and it mounts as soon as the first user logs in:

[code:1:985bca878a]
[default]
workgroup=WORKGROUP

[PIII]
addr=piii.192.168.1.1

[PIII:GUEST:STEVE]

[/code:1:985bca878a]

This is for a server named PIII, a user named GUEST, and a share named STEVE. Since I am using a router, I made the address the address of the router with the additions 'piii' as the host. Sound kosher?

Thanks for your help,
Steve

Strog
April 20th, 2004, 09:23
[PIII]
addr=piii.192.168.1.1

This just needs to be an IP address so you can drop the piii here.


[code:1:311147fd33]
//PIII/steve /some/mountpoint smbfs rw 0 0[/code:1:311147fd33]

Does you /etc/fstab have an entry something like this?


Since I am using a router, I made the address the address of the router with the additions 'piii' as the host.


Unless samba is running on the router or the router is doing some kind of port forwarding then you should use the actual IP address of the box running samba.