PDA

View Full Version : Where is samba



jimscafe
13th February 2008, 12:42 PM
I am trying to setup a simple file server for Windows pc to use.

I was following an article
Basic Networking: Windows to Linux Fedora

As this is just going to be a server I didn't want it to connect to the internet, so when I installed my live v8 Fedora, I turned off the firewall, and SELinux and set the IP address as fixed. I also disabled IPv6

The artile said that samba was part of the normal install hence I wasn't worried about the internet access - but when I type smb in a terminal window, it says command not found.

The article suggests typing locate samba, but I get can't open /var/lib/mlocate/mlocate.db

The article also suggests I try ls ľalt /etc/samba/smb.conf and I get no such file or directory.

This is all very confusing.

I have been able to ping the Fedora pc from a Windows PC and vise versa

I could temporarily connect Fedora to the internet through my dsl line (how would I do that?) or I could try to install samba some other way.

Any suggestions? Presumably samba is not on the live cd iso

SlowJet
13th February 2008, 12:57 PM
[darwinhwebb@Ruthie-07 ~]$ su -
Password:
[root@Ruthie-07 ~]# rpm -qa sam*
samba-common-3.0.28-0.fc8
samba-client-3.0.28-0.fc8


[root@Ruthie-07 ~]# yum info samba
...
Available Packages
Name : samba
Arch : i386
Version: 3.0.28
Release: 0.fc8
Size : 2.8 M
Repo : updates
Summary: The Samba Suite of programs
Description:

Samba is the suite of programs by which a lot of PC-related machines
share files, printers, and other information (such as lists of
available files and printers). The Windows NT, OS/2, and Linux
operating systems support this natively, and add-on packages can
enable the same thing for DOS, Windows, VMS, UNIX of all kinds, MVS,
and more. This package provides an SMB/CIFS server that can be used to
provide network services to SMB/CIFS clients.
Samba uses NetBIOS over TCP/IP (NetBT) protocols and does NOT
need the NetBEUI (Microsoft Raw NetBIOS frame) protocol.



root@Ruthie-07 # cd /etc/samba
[root@Ruthie-07 samba]# ls
lmhosts smb.conf smb.conf~
[root@Ruthie-07 samba]# cat smb.conf
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example
#
# For a step to step guide on installing, configuring and using samba,
# read the Samba-HOWTO-Collection. This may be obtained from:
# http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
#
# Many working examples of smb.conf files can be found in the
# Samba-Guide which is generated daily and can be downloaded from:
# http://www.samba.org/samba/docs/Samba-Guide.pdf
#
# Any line which starts with a ; (semi-colon) or a # (hash)
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command "testparm"
# to check that you have not made any basic syntactic errors.
#
#---------------
# SELINUX NOTES:
#
# If you want to use the useradd/groupadd family of binaries please run:
# setsebool -P samba_domain_controller on
#
# If you want to share home directories via samba please run:
# setsebool -P samba_enable_home_dirs on
#
# If you create a new directory you want to share you should mark it as
# "samba-share_t" so that selinux will let you write into it.
# Make sure not to do that on system directories as they may already have
# been marked with othe SELinux labels.
#
# Use ls -ldZ /path to see which context a directory has
#
# Set labels only on directories you created!
# To set a label use the following: chcon -t samba_share_t /path
#
# If you need to share a system created directory you can use one of the
# following (read-only/read-write):
# setsebool -P samba_export_all_ro on
# or
# setsebool -P samba_export_all_rw on
#
# If you want to run scripts (preexec/root prexec/print command/...) please
# put them into the /var/lib/samba/scripts directory so that smbd will be
# allowed to run them.
# Make sure you COPY them and not MOVE them so that the right SELinux context
# is applied, to check all is ok use restorecon -R -v /var/lib/samba/scripts
#
#--------------
#
#======================= Global Settings =====================================

[global]

# ----------------------- Netwrok Related Options -------------------------
#
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
#
# server string is the equivalent of the NT Description field
#
# netbios name can be used to specify a server name not tied to the hostname
#
# Interfaces lets you configure Samba to use multiple interfaces
# If you have multiple network interfaces then you can list the ones
# you want to listen on (never omit localhost)
#
# Hosts Allow/Hosts Deny lets you restrict who can connect, and you can
# specifiy it as a per share option as well
#
workgroup = WORKGROUP 100
server string = Samba Server Version %v

; netbios name = MYSERVER

; interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
; hosts allow = 127. 192.168.12. 192.168.13.

# --------------------------- Logging Options -----------------------------
#
# Log File let you specify where to put logs and how to split them up.
#
# Max Log Size let you specify the max size log files should reach

# logs split per machine
log file = /var/log/samba/log.%m
# max 50KB per log file, then rotate
max log size = 50

# ----------------------- Standalone Server Options ------------------------
#
# Scurity can be set to user, share(deprecated) or server(deprecated)
#
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.

security = user
passdb backend = tdbsam

...

SJ

shahak
13th February 2008, 12:57 PM
You have to install the samba server package and configure it with the conf file (not to mention that you have to start/restart the server also).

The smb client is not required to serve the files to your windows pcs. It may acces the windows shares/servers on the other networked machines.

Moray
13th February 2008, 04:18 PM
If you have your Live CD mounted on /mnt/live


find /mnt/live -name "samba*"

should find the rpms for you.

Moray
13th February 2008, 04:44 PM
No, silly (me). LiveCD is the one you boot from, isn't it. In that case


find / -name "smb*"

should find any bits of Samba that are installed.

bbfuller
13th February 2008, 04:55 PM
Hello jimscafe

The packages you require are on the DVD if you installed from that. However they are an option and don't get installed by default.

They are not on the live cd's.

If you have the DVD you are looking for four packages:

samba
samba-client
samba-common
system-config-samba

but the easiest way to install them is to do it over the internet simply with:


yum install samba

and:


yum install system-config-samba

and not use the dvd at all.

Otherwise it is probably easiest to put the four rpm's in a folder where there are no other rpm's - either from the dvd or after you have downloaded them elsewhere - and as root issue the command:


rpm -ivh *.rpm

Don't forget that in Fedora there are two services that need starting - or restarting after you have done any configuring - nmb and smb unlike some distributions which combine them.

jimscafe
18th February 2008, 10:46 AM
I think I have samba installed - at least I know some of it is installed.

I followed an article at

www.reallylinux.com/docs/basicnetworking.html

All went as per the article until it said

'From the Fedora main menu choose Network Servers'

I cannot find Network Servers on the menu anywhere.

With problems I then tried
/sbin/chkconfig --list
And smb is in that list (and so is nmb) but both are set to off all across the 0-6

In Konqueror location I typed
smb://pauldata (the name of the shared drive on Windows - cannot connect.

There are samba options on Settings - I have been and changed the security setting to Share

I also tried

cd /etc/rc.d/init.d
./smb start

and
./nmb start
And both reported services starting

Not sure what to try next?

bbfuller
18th February 2008, 11:04 AM
Hello jimscafe

If you are using Gnome:

System Menu - Administration - Services

to start the smb and nmb services. I start mine for run levels 3 and 5.

System Menu - Administration - Samba

to do at least the basic configuration of the samba server.

In the konqueror address bar you will at least need to type:


smb://<machinename>/pauldata

you may need to substitute the ip address for machine name in the previous.

This will probably assume that you have on the windows machine:

username and password

and that you have set up on the Linux machine both a Linux User and a Samba User with the same username and password.

The System Menu - Administration - Samba gives you the opportunity to define samba users.

I've left my security set to Users. I assume you have changed the Workgroup name to that used by your windows machine in the same dialogue.

markkuk
18th February 2008, 11:04 AM
That article is for Fedora Core 2, it's out of date by six releases. The official Samba documentation is available from samba.org (http://us4.samba.org/samba/). The best place to start may be Samba by Example (http://us4.samba.org/samba/docs/man/Samba-Guide/).

jimscafe
18th February 2008, 11:23 AM
I did what you said and also started something called lisa at levels 3 and 5

Konqueror now sees the drive on the PC!!!

However on windows when I go to connect a network drive I think I see the linux pc because it shows localhost which I don't think was there before and I think is the default for fedora. This is the netbios name - I guess I should change this to something sensible.

So I think Windows is seeing the linux pc but not the shared directories...

Is this correct or is my windows pc not seeing the linux pc?

bbfuller
18th February 2008, 07:20 PM
Hello jimscafe

I've never started the lisa service and my samba communications with Windows are two way.

There are several things I do when I set up my Linux machines, I've been doing them so long now that I can't honestly say which of them are necessary, you may want to try the following.

Make sure samba is allowed through the firewall.

In Gnome System - Administration - Firewall. I'm never sure just what sequence of steps you have to take to change things here. I "think" you would have to tick the samba service and "Apply" it, then "Disable" the firewall and "Enable" it again to make it aware of the changes.

My machines always have a hostname. Try, as root by using the:


su -

that's a space and a minus sign after the su, command. Then do:


hostname <desired machine name>

Then look in System - Administration - Network, highlight your network interface and click "Edit". My network has the machine name under dhcp settings but with the workgroup name as the second part. That is, my machine name is "atx17" and my workgroup "local". I defined this when I installed as the machine name and that's where it ends up.

As long as you have the three usernames and passwords identical you should now have a share visible in Windows under Network places of "your user id on samba server" with the samba version number and the machine name.

Try those. There may be one more thing to try but lets not over complicate things.

jimscafe
19th February 2008, 01:27 AM
bbfuller - you said

As long as you have the three usernames and passwords identical

The windows pc does not have a username - is this necessary if using the share option in Samba as opposed to the user option? I was hoping to get away without having to do this - but if it is necessary...

I got a message 'lis service not started' when doing something but I can't remember in my confusion what I was doing - so I started it along with nmb and smb just in case...

Thanks for the help everyone.

bbfuller
19th February 2008, 10:20 AM
Hello jimscafe

I've never tried samba without the three username/password combinations in place, but I rather think it is.

Windows isn't as security conscious as Linux and I believe that as long as you share something to everyone it won't care who logs into it if you don't have a user to hang the share on.

Linux is altogether different and just won't accept connections unless it knows who they are from.

It's one of its strengths, but when you first come across it, something that can be seen as annoying.

jimscafe
19th February 2008, 12:13 PM
I tried hostname as you suggested, it didn't do anything (logged in as root)

I went to setting - samba (kde)

And changed the netbios name that was successful

I created a new account on the linux and windows pc

On the windwos pc I again went the the setup local network 'wizard'

On Linux I tried two ways to add a samba client

1. Using the samba gui (settings then samba) - this allowed me to add a user - I added the new username I had just created, entered the username password - but it would not let me click the apply button. I click ok but when I return the user has not been added.
2. smbpasswd -a username
then entered password when prompted - still did not work.

I checked out the samba by example suggested by markkuk - I have a long smb.conf file so all I did was add security = SHARE
Then tried to check the validity by typing smbclient etc..
But there was no smbclient.
Phew!!

I can still see the windows pc from Linux but not the other way around.

I must be so close I guess..

markkuk
19th February 2008, 12:21 PM
I have a long smb.conf file so all I did was add security = SHARE
Then tried to check the validity by typing smbclient etc..
But there was no smbclient.

Smbclient is in the samba-client package, is it installed?

bbfuller
19th February 2008, 12:55 PM
Hello jimscafe

Did you follow my steps in post #6 to install samba or have you installed it from some other source?

If you have installed all the Fedora samba packages then you should have samba-client installed.

I've just tried on my machine and:


smbclient -L localhost

issued from a valid samba users command prompt gives a list of all that users shares on the machine.

If you don't have the samba-client package installed or the smbclient command available then I think we need to know exactly how you installed samba before we thrash around further suggesting configuration options for things that may not be installed.

Incidentally, which version of Fedora are you running. There was a version of system-config-samba that would not allow you to save changes to the smb.conf file but that has long gone. If you still have that problem and have the Fedora samba packages installed you would be well advised to get your installation updated somehow.

jimscafe
19th February 2008, 01:00 PM
How do I tell?

I thought it was the samba client, as opposed to the samba server, that allowed the linux pc to see the windows pc? (Or is it the other way around). If this is the case I can see and access the files from Linux on the windows pc so maybe the samba client is installed..
If this is wrong, then maybe the samba client is not installed...

I used
yum install system-config-samba
which I understand installs samba

jimscafe
19th February 2008, 01:45 PM
I will try to install samba again, I can't remember if I did

yum install samba

or just

yum install system-config-samba

(What is a valid samba users command prompt - sorry if I seem so dense?)

bbfuller
19th February 2008, 02:12 PM
Hello jimscafe

Samba client will allow the linux pc to see shares on a windows machine, you need the other samba packages when you come to share parts of you linux machine to windows.

Look at my post #6 here which says which packages to make sure you have installed. Some of them will be bought in as dependencies to other packages some won't.

Incidentally, if you want to see which packages you have installed at any time:


yum install yumex

will install a nice graphical package manager.

system-config-samba is just the fedora samba configuration gui. I'm not sure just what other parts it might or might not bring in with itself.

jimscafe
20th February 2008, 09:49 AM
yumex is installed and there is no samba-client installed according to the report from yumex.

Presumably I install that with
yum install samba-client

I will try this shortly

(Currently no internet access for the linux pc)

bbfuller
20th February 2008, 09:56 AM
Hello jimscafe

If you are trying for samba communication both ways then I would make sure that all four packages that I mentioned are installed at the same time.

Yumex will graphically tell you what you have installed and will make choosing and installing packages over the internet easy. But if you don't have internet access then you will need to use the:


rpm -ivh <packagename>

to install.

If you have several packages to install, put them in a directory by themselves and you can use the command:


rpm -ivh *.rpm

to install them all in one go.

Please make sure that you have all of the samba packages installed.

jimscafe
20th February 2008, 11:43 AM
Some success - I suspect the finish line is in sight.

I installed samba-client and all 4 packages you listed are shown in yumex

I went back into the samba toll under settings and tried to add a user - as before no success.

Then I changed the security option to user from share - and hey presto I could now add a user.

Then I changed the security setting back to share

I had made 2 directories shareable (or so I thought) one homes and one paul - the first user I created in Linux. However I could not create a user paul on Windows so I created a user fedserver on both pcs and added this user to samba.

Then I made the home directory of fedserver shareable in samba - and the windows pc can now access the fedserver directory - I copied a file to it from Windows...

However, I am not completely there as Windows will not connect to the shared paul directory even though it can see it - says network path not found.

I have played with various permissions, trying to make everything associated with paul shareable, visible, writeable etc. nut still no luck.

I don't know if it the installation of the samba-client that made this possible - I would have to go through this again to make sure.

I do need to understand what is going on as I plan to install a linux file share in my office. I own a small company (25 staff) and we currently use win98 as a file server, I wanted to move to Linux as a file server - and I won't do this unless I feel I understand what I did - so maybe I have to start over again and re-install Fedora. But first I must find out how to access other paths on the Linux box

Thank you for your patience so far...

bbfuller
20th February 2008, 04:01 PM
Hello jimscafe

I don't know all the answers about samba and as I have my setup how it works for me I can't be sure what changes I make are necessary to get what you want.

However, I think what you appear to want is a directory on the Linux machine that is directly useable by anyone on the Windows machine whether or not they have a user account on the Linux machine.

In my limited experimenting, I can do that by setting the security on the Linux machine samba installation to "Share" as you have done and then adding an entry manually to the particular share in the:


/etc/samba/smb.conf

file.

That entry is:


public = yes

You can see where I have added it in the two examples below:

before:


[boxroom]
comment = on atx17
path = /home/bbfuller/boxroom
writeable = yes
browseable = yes
guest ok = yes

after:


[boxroom]
comment = on atx17
path = /home/bbfuller/boxroom
writeable = yes
browseable = yes
guest ok = yes
public = yes

hope that helps

bbfuller
20th February 2008, 04:29 PM
Hello jimscafe

I tried this several times and didn't notice all that was happening in my smb.conf file.

It would appear that:

public = yes

and

guest ok = yes

set the same parameter. I added 'public = yes' back into my example above because I thought the samba configuration program was deleting it however it was just changing it to 'guest ok = yes'.

So if you add that 'guest ok = yes' option to a share it seems to allow the unrestricted access.

jimscafe
21st February 2008, 01:28 PM
I tried that very quickly without success, I will be out of town until early next week so will have another go then...

shahak
2nd March 2008, 05:08 PM
Please check smb.conf for the master browser option - making your linux box the preferred master browser, may help a unix user connect to his home directory.

jimscafe
3rd March 2008, 04:53 AM
I finally got it working using the Shares option in Samba. I also went into the network section and changed the setting and turned off advanced.

I also went back again to the files to make sure they were all public, writeable etc..

All of a sudden it worked - but I couldn't say exactly what made the final step.

I probably need to start again from scratch to recreate what I did. I wrote down all the steps I took, but again, I tried so many things...

Thanks for all the suggestions, finally made it and I now have a simple file server.

I will read more and learn more about file sharing with Linux - but now I have a server I can start using Linux for this purpose right away.