PDA

View Full Version : Samba


fedorabobblue
2006-02-22, 04:50 AM CST
Is it possible for samba to share a diretory to a certian machine name ?

For example this is there is one share that all of the 12pcs can see called ALL.I have got that bit working fine.

The problem im having if the windows machine name is called malcom

Can my samba server share a directory called malcom but only to
malcom on his windows machine ?

The reason for this is i dont want any 1 else seeing mlacoms folder

neilloffhagen
2006-02-22, 05:21 AM CST
Yes, you can do this. In the smb.conf file where you have the malcolm share add the line

hosts allow = malcolm

You probably have a similar line in the global section, allowing those being on your LAN access to the samba server. This will limit malcolm to be the only one to have access to that share. So it will also deny you, unless your machine name is the one called malcolm :) So you might want to add another machine name to the line. If so just put a space after malcolm and then add the other machine name.

If you can ping by his machine name this will work, but other wise you might need to put his IP address instead of the machine name.

You can run "testparm smb.conf" which will let you know if this will work or not. It will list out the effective settings for your Samba server.

Neil.

fedorabobblue
2006-02-22, 06:10 AM CST
I did that my friend and t didnt seem to work , I would do the ip thing but does not have static ip so this can not be done . My problem now is that it seems to havestopped giving me acess to my server and all i did was chnage the malcom part of the conf , i have restarted samba and still no access. any solutions

fedorabobblue
2006-02-22, 06:12 AM CST
sorry my bad the fire wall was stopping my server but cant get the malcom stuff working.

I have set host allow = malcom bob-office

no when i try access iyt ask me for a password


\testserver\guest

i dont no how to get about this 1

neilloffhagen
2006-02-22, 06:55 AM CST
Did you do the testparm smb.conf? It would be interesting to see then output from that? Not the whole output but there should be a bit that comes before you start the full dump.

Also, can you ping malcolm or bob-office, using the machine name? If not we might need to configure samba to use your wins or dns server?

Neil.

neilloffhagen
2006-02-22, 06:57 AM CST
Did you do the testparm smb.conf? It would be interesting to see then output from that? Not the whole output but there should be a bit that comes before you start the full dump.

Also, can you ping malcolm or bob-office, using the machine name? If not we might need to configure samba to use your wins or dns server?

Neil.
Forget that rubbsih I just posted. Didn't read your post properly. Can you rather post your full smb.conf? You could still do the testparm and post the whole of it's output.

Neil.

fedorabobblue
2006-02-22, 07:13 AM CST
Hey man here is my samba.conf for you

[global]

# workgroup = NT-Domain-Name or Workgroup-Name
workgroup = WORKGROUP

# server string is the equivalent of the NT Description field
server string = TestServer

# This option is important for security. It allows you to restrict
# connections to machines which are on your local network. The
# following example restricts access to two C class networks and
# the "loopback" interface. For more examples of the syntax see
# the smb.conf man page
; hosts allow = 192.168.1. 192.168.2. 127.

# if you want to automatically load your printer list rather
# than setting them up individually then you'll need this
printcap name = /etc/printcap
load printers = yes

# It should not be necessary to spell out the print system type unless
# yours is non-standard. Currently supported print systems include:
# bsd, sysv, plp, lprng, aix, hpux, qnx
printing = cups

# This option tells cups that the data has already been rasterized
cups options = raw

# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
; guest account = nobody

# this tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/%m.log
# all log information in one file
# log file = /var/log/samba/log.smbd

# Put a capping on the size of the log files (in Kb).
max log size = 50

# Security mode. Most people will want user level security. See
# security_level.txt for details.
security = share
# Use password server option only with security = server
; password server = <NT-Server-Name>

# Password Level allows matching of _n_ characters of the password for
# all combinations of upper and lower case.
; password level = 8
; username level = 8

# You may wish to use password encryption. Please read
# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.
# Do not enable this option unless you have read those documents
; encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd

# The following are needed to allow password changing from Windows to
# update the Linux system password also.
# NOTE: Use these with 'encrypt passwords' and 'smb passwd file' above.
# NOTE2: You do NOT need these to allow workstations to change only
# the encrypted SMB passwords. They allow the Unix password
# to be kept in sync with the SMB password.
; unix password sync = Yes
; passwd program = /usr/bin/passwd %u
; passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*success fully*

# Unix users can map to different SMB User names
; username map = /etc/samba/smbusers

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
; include = /etc/samba/smb.conf.%m

# Most people will find that this option gives better performance.
# See speed.txt and the manual pages for details
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

# Configure Samba to use multiple interfaces
# If you have multiple network interfaces then you must list them
# here. See the man page for details.
; interfaces = 192.168.12.2/24 192.168.13.2/24

# Configure remote browse list synchronisation here
# request announcement to, or browse list sync from:
# a specific host or from / to a whole subnet (see below)
; remote browse sync = 192.168.3.25 192.168.5.255
# Cause this host to announce itself to local subnets here
remote announce = 192.168.0.255 192.168.2.44 192.168.254.55

# Browser Control Options:
# set local master to no if you don't want Samba to become a master
# browser on your network. Otherwise the normal election rules apply
local master = yes

# OS Level determines the precedence of this server in master browser
# elections. The default value should be reasonable
os level = 255

# Domain Master specifies Samba to be the Domain Master Browser. This
# allows Samba to collate browse lists between subnets. Don't use this
# if you already have a Windows NT domain controller doing this job
domain master = yes

# Preferred Master causes Samba to force a local browser election on startup
# and gives it a slightly higher chance of winning the election
preferred master = yes

# Enable this if you want Samba to be a domain logon server for
# Windows95 workstations.
; domain logons = yes

# if you enable domain logons then you may want a per-machine or
# per user logon script
# run a specific logon batch file per workstation (machine)
; logon script = %m.bat
# run a specific logon batch file per username
; logon script = %U.bat

# Where to store roving profiles (only for Win95 and WinNT)
# %L substitutes for this servers netbios name, %U is username
# You must uncomment the [Profiles] share below
; logon path = \\%L\Profiles\%U

# All NetBIOS names must be resolved to IP Addresses
# 'Name Resolve Order' allows the named resolution mechanism to be specified
# the default order is "host lmhosts wins bcast". "host" means use the unix
# system gethostbyname() function call that will use either /etc/hosts OR
# DNS or NIS depending on the settings of /etc/host.config, /etc/nsswitch.conf
# and the /etc/resolv.conf file. "host" therefore is system configuration
# dependant. This parameter is most often of use to prevent DNS lookups
# in order to resolve NetBIOS names to IP Addresses. Use with care!
# The example below excludes use of name resolution for machines that are NOT
# on the local network segment
# - OR - are not deliberately to be known via lmhosts or via WINS.
; name resolve order = wins lmhosts bcast

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
; wins support = yes

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; wins server = w.x.y.z

# WINS Proxy - Tells Samba to answer name resolution queries on
# behalf of a non WINS capable client, for this to work there must be
# at least one WINS Server on the network. The default is NO.
; wins proxy = yes

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups. The built-in default for versions 1.9.17 is yes,
# this has been changed in version 1.9.18 to no.
dns proxy = no

# Case Preservation can be handy - system default is _no_
# NOTE: These can be set on a per share basis
; preserve case = no
; short preserve case = no
# Default case is normally upper case for all DOS files
; default case = lower
# Be very careful with case sensitivity - it can break things!
; case sensitive = no

#============================ Share Definitions ==============================
idmap uid = 16777216-33554431
idmap gid = 16777216-33554431
template shell = /bin/false
winbind use default domain = no
encrypt passwords = yes
guest ok = yes



#[homes]
# comment = Home Directories
# browseable = yes
# writeable = yes
# share modes true

# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]
; comment = Network Logon Service
; path = /home/netlogon
; guest ok = yes
; writable = no
; share modes = no


# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
# Set public = yes to allow user 'guest account' to print
; guest ok = no
; writeable = no
printable = yes

# This one is useful for people to share files
[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes

Test For netbios name
[Private malcom]
comment = Macloms Personal Files
path = /bob
hosts allow = malcom bob-office


# This one is useful for people to share files
#[Central]
# comment = Different one
# path = /central
# read only = no
# public = yes

# A publicly accessible directory, but read only, except for people in
# the "staff" group
#[public]
# write list = @staff

# Other examples.
#
# A private printer, usable only by fred. Spool data will be placed in fred's
# home directory. Note that fred must have write access to the spool directory,
# wherever it is.
#[fredsprn]
# comment = Fred's Printer
# valid users = fred
# path = /homes/fred
# printer = freds_printer
# public = no
# writable = no
# printable = yes

# A private directory, usable only by fred. Note that fred requires write
# access to the directory.
#[fredsdir]
# comment = Fred's Service
# path = /usr/somewhere/private
# valid users = fred
# public = no
# writable = yes
# printable = no

# a service which has a different directory for each machine that connects
# this allows you to tailor configurations to incoming machines. You could
# also use the %u option to tailor it by user name.
# The %m gets replaced with the machine name that is connecting.
#[pchome]
# comment = PC Directories
# path = /usr/pc/%m
# public = no
# writable = yes

fedorabobblue
2006-02-22, 07:13 AM CST
aand here is my testparm results

[global]
server string = TestServer
security = SHARE
log file = /var/log/samba/%m.log
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
printcap name = /etc/printcap
os level = 255
preferred master = Yes
domain master = Yes
dns proxy = No
remote announce = 192.168.0.255 192.168.2.44 192.168.254.55
idmap uid = 16777216-33554431
idmap gid = 16777216-33554431
guest ok = Yes
cups options = raw

[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No

[tmp]
comment = Temporary file space
path = /tmp
read only = No

[Private malcom]
comment = Macloms Personal Files
path = /bob
hosts allow = malcom, bob-office

neilloffhagen
2006-02-22, 07:33 AM CST
Couple of questions to clarify things - when Malcolm accesses from his machine what account is he logged on the machine with? Is it an account of his own or a general account that everyone is using to access the samba shares?

If it's his own account you could try the following for his share in your smb.conf instead? This way he could have access whatever mnachine he's on, as long as he was logged in a malcolm. And you could add your name to the line as well, so you had access as too. Only thing here is thatbyou'd have to add a user account with the same password on the Linux box, as he had on his Windows box. Is this a windows domain, or a workgroup of several windows boxes?

Neil.

[Private malcolm]
comment = Malcolms Personal Files
path = /bob
valid users = malcolm
public = no
writable = yes

fedorabobblue
2006-02-22, 07:49 AM CST
Didnt quite understand that fully


Basically e have 12 xp machines they all have usernames and passwords

all the usernames and passwored are just basic like below. Except machine names are diffrent for each user. 1 user to each machine . I have basically setup the smb.conf like u can see i have made no usernames or passwords on the server

Ok so lets just say we are on my machine this is my windows machine.

Im using no domain either just a workgroup

username is administrator bob
password xxxxxxxxxxxxxxxx
machine name : bob-office

So im logged on in windows i go to view workgroups and computers in netwrok nieghboorhood.

Click view workgroups

i see my server testserver

double click it , im inside

i can now see

private malcom and tmp

if i click tmp im in and all is fine if i click private malcom i get this

username: Tetserver\guest (This is grayed out cant touch this)
password : (Dont no what to put here)

neilloffhagen
2006-02-22, 07:56 AM CST
Try adding the line:

guest ok = Yes

to the Malcolm share bit. I'm wondering if as you're now specifing a "host allow = malcolm" it is reverting to the default "guest ok = no" and need to specify it for the share, even though you have it defined in the global section?

Neil.

fedorabobblue
2006-02-22, 08:08 AM CST
Still ask for a password

but if i do a testparm the guest ok is not coming up on malcoms share.

thanks for ur help man i do appricate this wsorry if its annoying u

neilloffhagen
2006-02-22, 08:25 AM CST
It's not annoying, just a bit frustrating that we can't get it working :) Happy to help, though don't seem to be actually helping much yet :)

Not sure what could be causing this, execpt that the allow user = malcolm is working, but may be too well :)

Is there any chance you could have mistyped the machine name in the smb.conf file? The windows machine names and the samba allow user = names need to be exactly the same spelling, being case-sensitive as well.

Neil.

fedorabobblue
2006-02-22, 08:33 AM CST
Ok on my windows machine the machine name is bob-office lets forget malcom for a mintue .

and we still have the share private malcom

[Private malcom]
comment = Macloms Personal Files
path = /bob
hosts allow = bob-office

i have taken off the guest ok part as this has made no diffrence for the moment .

i cant acess it still and my spellings are all lowercase and exactly the same.

I guess because its saying guest and asking me for a a password . It must be something to do with guest. Im so confused samba aint all that easy.

Do i have to have like a guest account on my smaba server or something

neilloffhagen
2006-02-22, 08:42 AM CST
Just to check - if you coment out the hosts allow line and you access the malcolm share okay then?

There is a guest account, but as the other share hasn't needed it, neither should malcolm share. That's why I'd like to test the malcopm sahre is available if opened up. If you do an ls -ls /tmp and an ls -ls /bob do they show the same?

Neil.

fedorabobblue
2006-02-22, 08:53 AM CST
here are the results my friend

/tmp
total 12
-rw-r--r-- 1 root root 10325 Feb 22 22:08 smb.conf

/bob
total0


And when i comment out host allow i can acess it

thats what i mnent by i thougth we were getting somewhere because at least its asking for some kind of authercation

neilloffhagen
2006-02-22, 09:40 AM CST
I must admit to being a bit unsure where to go next with this. Couple of other suggestions, one is the workgroup the same for the Samba smb.conf as it is on the Windows machines? Are they both WORKGROUP, as you have in the smb.conf file?

workgroup = WORKGROUP

Also, you could uncomment the next line in the smb.conf file and see what happens?

guest account = nobody

Neil.

fedorabobblue
2006-02-22, 09:49 AM CST
ok my friend well thanks for your help i will try posting another forum later ,

Workgroup is set right as i can see the machines

i can see the folders itsgot be something to do with permissions users or passwords , i have a massive samba book infront of me and no help .

I guess its to do with users as if i comment host allow again its starts asking for a passwrod and has \testserver\guest written as the user so i guess

maybe i could try setting a user on my linux box called malcom and a give it a password.

but i dont no how to do the samba usernames and passwords and getting it to link to the folder /bob

but if we could do this maybe we could add a line

valid users = malcom

or something like that can u see where im coming from ?

neilloffhagen
2006-02-22, 09:54 AM CST
To creat a samba user when logged in as root type

smbpasswd malcolm (or whatever name)

It will then prompt you for a password and ask for confirmation. Just use the same password as the windows machine has and if you add the

valid users = malcolm you should hopefully finally get in :)

Neil.

fedorabobblue
2006-02-22, 09:57 AM CST
[root@testserver samba]# smbpasswd malcom
New SMB password:
Retype new SMB password:
Failed to find entry for user malcom.
Failed to modify password entry for user malcom
[root@testserver samba]# smbpasswd malcom

fedorabobblue
2006-02-22, 09:58 AM CST
is there not samba users thingy

or do i need to mkae a proepr linux users im confused im sorry

neilloffhagen
2006-02-22, 01:16 PM CST
Sorry, should have said you need to create the Linux user of the same name and password first, then do the smbpasswd bit.

You can create the unew ser through under Syatem settings -> Users and Groups.

Sorry for the dealy, in replying but I'm home now and was at work earlier.

Neil.

fedorabobblue
2006-02-22, 01:33 PM CST
hmmm im on the command line no graphical interface

adduser malcom
passwd malcom

smbpasswd malcom

[root@testserver ~]# smbpasswd malcom
New SMB password:
Retype new SMB password:
Failed to find entry for user malcom.
Failed to modify password entry for user malcom

not sure whats hapening

any ideas my friend

alyster
2006-02-22, 03:37 PM CST
Try using smbpasswd -a <user>

Firewing1
2006-02-22, 03:50 PM CST
See my server setup link in my signature, that explains share protection, SMB section. Basically, set file permissions in the main share and no one will have access.
Firewing1

fedorabobblue
2006-02-23, 02:55 AM CST
I canot use ur guide my friend i have no graphical desktop

Firewing1
2006-02-23, 03:19 PM CST
In that case,
vi /etc/samba/smbusers.conf
the format is
linuxusername = windows_or_sambeusername
For example, in mine I want "root" to be "root" as I have my account name to "admin". The original file is:
root = admin
admin = someotherusername
As "admin" was already taken. So, I modified it:

root = root
admin = admin
Now admin is admin and root is root.
then set their samba passwords.
Firewing1

fedorabobblue
2006-02-24, 02:53 AM CST
so if i have a password for malcoms share is there a way for me to make it visible only by his machine name or username and password

neilloffhagen
2006-02-24, 03:16 AM CST
so if i have a password for malcoms share is there a way for me to make it visible only by his machine name or username and password
I'd jave thought putting in allow hosts = or the valid users = would do that? Or is that not working at all now?

Neil.

fedorabobblue
2006-02-24, 03:20 AM CST
Nope neer got it working still really annoying me

Firewing1
2006-02-24, 06:08 PM CST
This is an example of my share... It works fine...
comment = Extra Storage
path = /data/Storage
writeable = yes
browseable = yes
valid users = admin, user1, user2
Firewing1

neilloffhagen
2006-02-25, 01:59 AM CST
If the last post still does not work there is one other thing that could be causing the problem that I haven't seen mentioned yet in this thread, unless I missed it and that is to turn off SElinux permssiions?

Give it a try. I know there was something esle a whle back I was trying on RHEL 4 that wouldn't work unitl I turned off SElinux. Probably could have got it working with SE if I'd had the time to learn it all.

You're comand line only? Might need to google to find the command to turn it off.

Hope this does get you going. I kmoe the frustration of Linux at times, but also know the joy of getting things working. Don't give up :)

Neil.

fedorabobblue
2006-02-25, 06:33 AM CST
yeh jan thats cool could i possily take a look at your config files if possible

jhetrick62
2006-03-26, 10:26 PM CST
Guys, you need to run a basic smb.conf file like FireWing said. If you con't have gui, here is my file. It works quite well on FC3, FC4 or FC5. Same exact file on 4 & 5 as they exist on the same machine so I boot into either. On the FC3 machine, the file is different in the share section and also I make it a Wins Client instead of the Wins Server. After running this file, adding smb users is just as said above usually. Create a user on machine and run smbpasswd username. If that doesn't work, post back your permissions on the smbpasswd file.

Goodluck,
Jeff
BTW, I copied this file from another source myself and just modified the workgroup, netbios and share settings along with Wins.