Click to See Complete Forum and Search --> : Configuring Samba


hongman
02-18-2005, 07:57 PM
Hi all

Ok, new to this so please bear with me!

I have a Knoppix box and XP Box, *****peer style networked. I want to use Samba to share files.

I opened /etc/samba/smb.conf and make a few changes, namely setting the workgroup name and stuff. I also did the testparm /etc/samba/smb.conf and it came up ok.

On my XP Box, in Network Places I can see the Knoppix box but on double clicking I cant log in. I trid usernames for Root and as Normal User but they didnt work. What gives?

Also, now when I open Samba Network Neighbourhood on the Knoppix box I get 'Please Provide Authentication for' and again, I dont know what to put.

Also, related but seperate problem. I created a folder in Home called Shared, for that reason: I want to share it. But upon clicking on OK, it says 'Sharing /Home/xxx/Shared failed' under Details it says Please Make sure the Perl Script fileshareset is suid Root'. ???

Thanks for any help! Linux is hard to learn after only Windows experience but very enjoyable!!

HOng

soulestream
02-18-2005, 10:32 PM
On my XP Box, in Network Places I can see the Knoppix box but on double clicking I cant log in. I trid usernames for Root and as Normal User but they didnt work. What gives?

you need to have an account setup that is a smbuser.
you can use smbpasswd -a username

then when you access the box from xp use that login.

then you will need to setup a share on your linux box. there are a couple of ways of doing this. you can probaly apt-get a program called swat, that will set up your smb.conf file for you. just google samba-swat.

or you can manually edit smb.conf

you have to set shares as root, not as user, that should fix your last error

as far as getting to your xp box make sure the linux user you are logged in as has rights to the xp box. make sure XP s file wall is set to allow file/print sharing.


soule

hongman
02-18-2005, 11:25 PM
Thanks

Ok, so I did apt-get install swat

It downloaded it...now what? I got a prompt saying if I had a heavily customised smb.conf file to back it up, I hit enter for OK and then...nothing!

I managed to set up a folder and share it logged in as root. Thanks for that one.

However, 2 issues.

Logged in a root or not, if I go to Samba Network Neighbourhood it asks me for authentication. No username/password works.

Oh, and I did the smbpasswd -a thing, that went ok.

On the Xp machine, if I go to View Workgroup Comouters I dont see the linux box anymore it says please make sure you have permission, etc. No firewall running or anything like that.

Thanks

Hong

thaddaeus
02-18-2005, 11:44 PM
if you don't care about security on each share ie needing a username a password then set
security = share

and set the share somthing like

[share]
comment = this is a share
path = /path/to/share
browseable = yes

make sure that that shared directory is set to 0777 or that sambas default user has write access to that share or you will only be in read only mode. i suggest reading the samba man file or checking out the http://www.samba.org website to read up on useing samba, it will clear up many questions you may and or will have later.

soulestream
02-19-2005, 12:43 AM
if swat is installed and running. Im sure knoppix has some little tool to start/stop services, go to to any web browser and type

127.0.0.1:901 enter root and password

that will give you a gui to setup samba. you can set shares and config users and permissions.

make sure the xp box and linux box are on the same network and workgroup


soule

btw i think swat has a little wizard, but i never used it.

hongman
02-19-2005, 09:31 AM
Thanks for the replies.

I set the security = share , still no difference. And I cant find the bit where I set the numbers...

Soule: I tried it, just said connection refused.

After all this mucking around, I think I may have fluffed up the conf file. Is there any way I can reset it back to default, so I can start over?

Thanks

Hong

nebs
02-20-2005, 02:44 PM
I just set up samba to network my mandrake box with my win xp machine. This is my smb.conf file. The [tmp] part is accessible without any passwords, the [user] part allows me to connect from windows to my pre-existing user account.

After you make these changes you have to: smbpasswd -a user
(then add a password that is 8 characeters at least, if you're using the password level = 8 option)

Note that user has to be a pre-existing user with a /home/user folder.


[global]
workgroup = WORKGROUP
netbios name = NAME
server string = NAME

log file = /var/log/samba/log.%m
max log size = 50

map to guest = bad user

security = user
password level = 8 # My samba password is 9 characters
; username level = 8
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd

wins support = yes

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes

[user]
comment = user directory
path = /home/user
valid users = user
public = yes
writable = yes
printable = no

Hope this helps.

nebs
02-20-2005, 02:51 PM
One more thing: After I did all that stuff above, I found that it still wasn't connecting properly (ie not accepting my username/password) but it all worked after I rebooted win xp...stupid win xp.

hongman
02-20-2005, 03:08 PM
Thanks nebs.

Is that your WHOLE smb.conf file?

Mine seems a bit longer (by default). I'll give it a go anyways

Thanks

Hong

hongman
02-20-2005, 03:09 PM
One more thing, how do i find out what my NetBIOS name and Server name is??

soulestream
02-20-2005, 04:32 PM
well i quess technically your netbios name would ne the name of the box. but netbios is a MS protocol, so hmmmm


soule

hongman
02-20-2005, 04:40 PM
Ok then what about the Server name?

I ask coz now I am using the above smb.conf file if I type


smb:/workgroup

and enter the username + password I chose on smbpasswd -a I can see both PC's.

However when I click on the says "error connecting to server responsible for smb://mypcname/"

Now what should I try?

soulestream
02-20-2005, 05:46 PM
netbios name = NAME

name of your computer that is running smb



server string = NAME
this can be something like "samba server"

make sure the windows and the linux box have the same workgroup name.

make sure whatever folder you are trying to access you have permissions to.
i.e. if your user name on your linux box is bob. you share /home/bob as your shared folder. only user bob(or root) can access that folder. if you smbpasswd -a a user named ted, ted wont be able to access bob's home folder. try creating a share at /mnt/sharename in you smb.conf(make sure to actually create the folder) then u can chmod +777 /mnt/sharename to give all users access to it.


to start swat try /etc/init.d/swat start

then try the 127.0.0.1:901

that should get you into swat


soule

hey my 500th post:D

hongman
02-20-2005, 06:28 PM
Thanks soule and congrats on the 500th post :)

Now we are getting somewhere...

I tried to share a folder in my home file called 'share', but it said that a Perl file needed to be suid or something...

But I turned off my Firewall on my XP PC (Sygate Pro) and now I can see the XP box from the linux box...

Just not the other way round. I think i know why:

The only file shared on the Linux box is /root/Shared, and even then thats under root and not normal user. So in fact the XP box cant see any shares to connect to...

Also, in XP Network Neighbourhood there are no PC's. ???

I also tried to create /mnt/Shared, which I did and did chmod +777 but I cant share that either. Says you can only share files in your home folder.

As for SWAT, tried /usr/init.d/swat start but it said no such file. 127.0.0.1:901 wont work either.

However, if in the xp box I type http://mylinuxip I get the Apache page...

Soule, I thnk I am getting closer.

Main concern right now is:

How to get the XP box to see the Knoppix Box.

What services to enable on my XP firewall, since that is the primary connection to the net I dont want to be left without a firewall active.

But apart from that we are nearly there!!

I dont think you know how much I am thankful for people like you!

Hong

nebs
02-20-2005, 08:05 PM
It sounds like you don't have the same workgroup between your win xp machine and your samba config file.

In win xp, type this in your address bar:

\\netbios_name\user

where NETBIOS_NAME is of course your netbios name from your smb.conf file and USER is actually the part of your smb.conf file that says [user] without the square brackets

ie, the [user] part from here:

[user]
comment = user directory
path = /home/user
valid users = user
public = yes
writable = yes
printable = no

soulestream
02-20-2005, 08:50 PM
check the above.

btw I forgot something about swat. after you install it you need to start xinetd

service xinetd restart

then you should be able to access swat. im setting a share right now and ill post my smb.conf

soulestream
02-20-2005, 09:15 PM
well hell i cant remember how to share a non user folder. but for the time being

1. useradd bob
2. smbpasswd -a bob
3. go to swat to global set your server name, workgroup, security=user,everything else use whats there. commit changes
4. go to shares button
5. type in sharename under "create share" and click create share
6. set path to /home/bob
7. readonly = no
8. guestok = no
9. commit changes
10 goto status button and restart all
11. you should be able to access the shares the Network neighborhood on your xp box. ill try to remember how to use a non-user directory.

**for bob I usually use the name of the XP computer**


soule

[edit] a-ha i new it had something to do with masks

mkdir /mnt/share(the one from before willbe fine)
go to swat and to shares
create share "sharename"

click on advanced

make your share as before except point your path to /mnt/share

1. username = bob
2. readonly = no
3. create mask = 0777
4. directory mask = 0777
5. guest ok = no
6. user only = yes

commit changes and restart all

you should be able to see the /mnt/share and read and write to it


soule

thaddaeus
02-21-2005, 03:01 AM
As Connecting to a service or port or ip or whatever is usually not blocked by the ms firewall just stuff connecting to it. Also can you please post your smb.conf file so i may see some of whats in it and maybe fit it to what you really need.

hongman
02-21-2005, 02:20 PM
Soule

Thanks the info you posted looks promising, but I just need to get SWAT enabled/started.

I tried typing:

start xinetd
xinetd start
service xinetd restart
service xinetd start

Still no go.

What am I supposed to be typing?

theaddeous: I'll post a new post with my current smb.conf file. Thanks.

hongman
02-21-2005, 02:23 PM
[global]
workgroup = WORKGROUP
netbios name = hackerbox
server string = samba server

log file = /var/log/samba/log.%m
max log size = 50

map to guest = bad user

security = user
password level = 8 # My samba password is 9 characters
; username level = 8
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd

wins support = yes

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes

[user]
comment = user directory
path = /root/shared
valid users = user
public = yes
writable = yes
printable = no

As I said, right now I can access all XP shares from the Linux box, just not the other way round...

Hong

thaddaeus
02-21-2005, 02:53 PM
as someone who has been using samba for a wile i belevie swat is not necesarily useless but more complicated than reading a man page and editing the smb.conf manually. so i wouldn't worry too much about swat.

But just to check on a few things, in your /etc/samba folder how many .conf files are there. What some newer version of samba do is add a winbind-smb.conf and smb.conf and i think one more, make sure there is only one. you seem to not be using winbind so just remove it, you only need the smb.conf file as the only .conf file. Also make sure that samba is running, smbd and nmbd, do this by either if your distro is nice by typing

>samba status
or if not try looking i your /etc/rc.d folder, the file your looking for is smbd or samba or smb

try also if you can't find it

>whereis samba
or one of the other forms of the word.


and run the file by ./samba status or ./smbd status

also after changing a config file run testparm then restart samba to commit changes. testparm checks syntax of the .conf file

most services if started manually (like samba or xinetd) use

>servicename start
for future referance

that smb.conf file you have is fine and does work i just had one question about the [users] share

if your trying to share a users home dir its easier and painless to do

[homes]
browseable = no
writeable = yes

this automatically maps to the users home dir associated with there linux user profile and won't exist if user is guest.

soulestream
02-21-2005, 02:53 PM
try whereis service on FC3 it is not in path by default. knoppix may be the same way

you may have to

/sbin/service xinetd restart


maybe somebody who uses debian based systems can post how to start/restart services in debian if that is not the right way


soule

hongman
02-21-2005, 03:00 PM
theaddeaus:

Everything you asks checks fine, testparm, whereis samba, etc etc.

So I replace

[user]
comment = user directory
path = /root/shared
valid users = user
public = yes
writable = yes
printable = no

with


[homes]
browseable = no
writeable = yes

Right?

hongman
02-21-2005, 03:02 PM
soule

It didnt work :p

Thanks for trying tho

Hong

soulestream
02-21-2005, 07:47 PM
well if the swat thing doesnt work.

try the above if you want to share the home directory of the user you created.


or you can use
[share]
path = /mnt/share
username = bob
valid users = bob
read only = No
create mask = 0777
directory mask = 0777
only user = Yes

to share a non-home directory


soule

thaddaeus
02-21-2005, 09:09 PM
ok so all parms are correct but you still cannot access the linux shares from xp. Does your linux box have a firewall on it if so make sure that theport samba uses is open on the linux box i beliive its somthing like 445 or 139 i can't seem to remember (i am sort of sick lately) also just noticed try adding this line into the globals section

interfaces = eth0 ip.of.network.card

this will bind samba to that ip and interface and may get it noticable

PNash
02-21-2005, 10:51 PM
Not sure if this will help but add this to your global area

hosts allow = 192.168.x.x or 10.0.x.x 127.0.0.1

If you are using a 192.168.x.x network just put 192.168.0.0 and it will know to use that whole range or you can specify the exact address of the XP Box


Customize it for your network obviously but it might help you get a step closer to figuring this thing out

hongman
02-22-2005, 05:02 AM
Hmm, this is looking more and more like a firewall issue. Would be interesting to find out coz I think its blocking my VNC requests from the XP box as well.

I'll add those and repost my smb.conf file when I get in from work.

Many thanks.

Hong

soulestream
02-22-2005, 10:44 AM
stop iptables then. you can always turn it back on and configur e it. just turn it off and see what happens. you may have to reboot the xp box afterwards



soule

hongman
02-22-2005, 10:51 AM
I'll try that when I get in...thanks

Hong

hongman
02-22-2005, 01:38 PM
How do I (what command) do I use to stop IPTABLES?

hongman
02-22-2005, 01:39 PM
HURAYYY!!!!!!

YIPPPPEEEE!!!

It works!!!

This is my final smb.conf file...YES YES YES!!

[global]
workgroup = WORKGROUP
netbios name = hackerbox
server string = samba server
interfaces = eth0 192.168.0.2
hosts allow = 192.168.0.1

log file = /var/log/samba/log.%m
max log size = 50

map to guest = bad user

security = user
password level = 8 # My samba password is 9 characters
; username level = 8
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd

wins support = yes

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes

[user]
comment = user directory
path = /root/shared
valid users = user
public = yes
writable = yes
printable = no

[share]
path = /mnt/share
username = hong
valid users = hong
read only = No
create mask = 0777
directory mask = 0777
only user = Yes


Thanks to EVERYONE that helped, you all played a part and I am forever in your debt.

Wahoo!!:D :D :D

hongman
02-22-2005, 01:45 PM
Ok spoke a little too soon...

I can see individual folders in XP:

TMP, Shared and User.

But...

I cant access any of them. I know that I cant access Shared becuase that resides in /root/shared, and I am not viewing this as root, I'm doing it as Hong.

I hear you. Why not share a folder in the /home/hong dir?

Well when I do, I error immediately and it says Perl 'fileshareset' need to be root setuid.

Solve that bit, and I think I am in!

hongman
02-22-2005, 01:48 PM
Man I should really stop talking to myself ;) :p

Got it working, made a few mods myself that seemed to have worked.

[global]
workgroup = WORKGROUP
netbios name = hackerbox
server string = samba server
interfaces = eth0 192.168.0.2
hosts allow = 192.168.0.1

log file = /var/log/samba/log.%m
max log size = 50

map to guest = bad user

security = user
password level = 8 # My samba password is 9 characters
; username level = 8
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd

wins support = yes

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes

[user]
comment = user directory
path = /home/hong
username = hong
valid users = hong
public = yes
writable = yes
printable = no

[share]
path = /mnt/share
username = hong
valid users = hong
read only = No
create mask = 0777
directory mask = 0777
only user = Yes

I still cant access [share] or [tmp] but I'm not overly bothered to be honest.

Many thanks again!!

Hong