Mailinglist Archive: opensuse (1750 mails)

< Previous Next >
Re: [opensuse] Samba Frustration (SOLVED) - a start on another day..
  • From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
  • Date: Wed, 01 Oct 2008 14:39:22 -0500
  • Message-id: <48E3D1EA.7020802@xxxxxxxxxxxxxxxxxx>
Kai Ponte wrote:
On Monday 29 September 2008 09:24:57 pm Jim Flanagan wrote:
[kai]
username = kai
write list = kai
read only = No
guest ok = Yes
available = No

Why do you have available = No ??

Um, because teh SWAT team told me to write that?

Actually, I just gave what the SWAT utility wrote. Is that wrong?


...

I actually just did some searching. Apparently there's a command-line utility
called testparm that can be run as root. It shows what samba will do with the
current configuration file.

Here's what I get.


xwing:/home/kai # testparm /etc/samba/smb.conf
Load smb config files from /etc/samba/smb.conf
Processing section "[kai]"
WARNING: No path in service kai - making it unavailable!
NOTE: Service kai is flagged unavailable.
Processing section "[homes]"
Processing section "[share]"
WARNING: No path in service share - making it unavailable!
NOTE: Service share is flagged unavailable.
Loaded services file OK.
Server role: ROLE_STANDALONE


Hmm - that ain't good.

Robert Urich came out and told me I'd better change. So I launched SWAT
(http://www.youtube.com/watch?v=nUJu17fAnKU) and now have the following...

# Samba config file created using SWAT
# from 127.0.0.1 (127.0.0.1)
# Date: 2008/09/29 21:32:31

[global]
valid users = kai

[kai]
path = /home/kai
username = kai
write list = kai
read only = No
guest ok = Yes

[homes]
valid users = %S
read only = No
browseable = No



I did an rcsmb and an rcnmb restart and both came out okay. I did a testparm
and it came out okay

xwing:/home/kai # testparm /etc/samba/smb.conf
Load smb config files from /etc/samba/smb.conf
Processing section "[kai]"
Processing section "[homes]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions


However, I get a timeout when testing smb:\\192.168.0.101\kai (my ip on my
local network)

An error occurred while loading smb:\\192.168.0.101\kai:
Timeout on server

I then tried smb://192.168.0.101/kai and got it...

http://www.perfectreign.com/stuff/2008/smb_share2.png

...and from my wife's Win2K machine...

http://www.perfectreign.com/stuff/2008/samba_connect.jpg


Whew! Finally.

Thanks for the help!

Now, on to making it easier and doable from the right-click menu on Konqueror.

(But that is for another day.)


Kai,

I haven't followed the whole thread, but if you want to make
connections easier either from linux->remote smb shares or from windows
-> remote smb shares, I have a few tricks for you.

First Linux -> smb; Just define a place to mount the remote shares (I
just use /mnt) and then a simple bash script will take care of the
mounts for you. I just write a mount script for each machine, and then
if I have multiple machines in a group, just combine the calls in a
second group script. Here is what I use for a machine script:

#!/bin/bash

# check_root however you do it.

SERVER="//nemesis"

if smbclient -U% -L${SERVER} >/dev/null 2>&1; then

OPTS=$(cat /home/david/bin/mntops_dcr)

SHARE="/config"
MPOINT="/mnt/nemesis-cfg"

if mount | grep -q "on ${MPOINT} type"; then
echo "${MPOINT} already mounted"
else
if [[ ! -d ${MPOINT} ]]; then
mkdir -p ${MPOINT} >/dev/null 2>&1
fi
mount.cifs ${SERVER}${SHARE} ${MPOINT} ${OPTS}
fi

SHARE="/samba"
MPOINT="/mnt/nemesis"

if mount | grep -q "on ${MPOINT} type"; then
echo "${MPOINT} already mounted"
else
if [[ ! -d ${MPOINT} ]]; then
mkdir -p ${MPOINT} >/dev/null 2>&1
fi
mount.cifs ${SERVER}${SHARE} ${MPOINT} ${OPTS}
fi

SHARE="/david"
MPOINT="/mnt/nemesis-david"

if mount | grep -q "on ${MPOINT} type"; then
echo "${MPOINT} already mounted"
else
if [[ ! -d ${MPOINT} ]]; then
mkdir -p ${MPOINT} >/dev/null 2>&1
fi
mount.cifs ${SERVER}${SHARE} ${MPOINT} ${OPTS}
fi


exit 0

The mntops_dcr (mount options) file is:

-o username=david,uid=1000,credentials=/home/david/.dcr/mountcfile,noperm

NOTE: remove the ',noperm' for regular users, it provides 'root' access
(which is very handy for remote admin of linux boxes, but not for
regular users). The credentials file protects the user/passwd with
permissions of 0600. The contents:

username=yourusername
password=yourpassword

To sew multiple machines together in a group, so you are mounting all
the needed shares on a local lan, simply combine the calls:

#!/bin/bash
sudo /home/david/bin/mount_nemesis
sudo /home/david/bin/mount_nirvana
sudo /home/david/bin/mount_zion

That's it for the linux->smb side. For windows a slick batch file can
be put in the startup folder of the startmenu to handle things. It will
handle multiple locations as well and test for the available machines.
In its DOS glory:

@echo off
net use /delete *
for /f "skip=3" %%i in ('net view') do (

if %%i==\\NIRVANA (
net use f: \\nirvana\samba
net use g: \\nirvana\config
net use h: \\nirvana\david
)

if %%i==\\BONZA (
net use f: \\bonza\samba
net use g: \\bonza\config
net use h: \\bonza\david
)

if %%i==\\NEMESIS (
net use i: \\nemesis\config
)

if %%i==\\PROVIDENCE (
net use i: \\providence\config
)

if %%i==\\ZION (
net use j: \\zion\config
)

)

These scripts have taken care of 99% of all the connection needs I have
had with samba. Note: this is in a non-domain login (or stand alone)
samba environment. If you are using domain logins, you can adapt the
login scripts as needed. Hopefully this will save some work.

--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups