You are not logged in.

#1 2012-08-08 02:02:33

japenagosc
Member
Registered: 2012-01-19
Posts: 78

[solved] How to? - Samba and shares

Hello everybody.

I have no idea what to do next, so that's why i'm here, asking you guys.

This is the situation: i have a network with 3 PCs: 1 with Arch, 1 with Arch and Win7, and other with Win7. I want to configure some folders to share some common files among these three computers, without (i think) the need to have permissions (or Samba users... i think)...

I installed Samba, and i've done all the things explained in the Archwiki, but i can't currently make this work.

Could you give me some advice?

Thank you very much.

[EDIT] I have solved the problem... well, i'm not quite sure, but i managed to make things work. What have i done? i create the Samba user "nobody", and gave access to a specific folder.

[global]
   workgroup = MyWorkgroup
   server string = ArchSamba %v
   netbios name = myNetbiosName

   hosts allow = 192.168.

   security = user
   guest account = nobody

[To Print]
   path = /home/public
 
   public = yes
   browseable = yes
   writable = yes

[My Music]
   path = /media/data/mp3

   public = yes
   browseable = yes
   writable = no

[My Files]
   path = /home/jaime
   
   valid users = jaime
 
   public = no
   browseable = no
   writable = yes

[printers]
   printing = cups
   printer name = lexmark

   path = /usr/spool/public   
   public = yes
   printable = yes
   browseable = yes

   use client driver = yes

I'll close this topic. Thank you all for your help and guidance.

Last edited by japenagosc (2012-08-29 04:41:36)

Offline

#2 2012-08-08 03:23:03

W4RH4WK
Member
Registered: 2012-08-03
Posts: 27

Re: [solved] How to? - Samba and shares

sharing folder under Win7 shouldn't be a problem.

i guess you already edited the smb.conf file which holds the configuration for samba. (restart samba after editing the smb.conf)

please tell me, what exactly is not working / what are you trying to achieve but haven't figured out yet.
also posting your smb.conf could help.

another thing that should be mentioned: samba has it's own user database, so the system users under linux are not usable via samba right from the start you need to add them to the smb database manually (see smbpasswd)

Offline

#3 2012-08-08 04:03:46

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,727

Re: [solved] How to? - Samba and shares

Are you trying to share a folder on your Arch box with your windows box?  Or are you sharing a folder on your windows box, and trying to see it from your Arch box?

What desktop environment are you using?  Do you want to use a GUI filemanager?

The easy way to start is by sharing a folder on the Windows box and trying to connect with something like Dolphin.  All other things being equal, how about if we start there?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#4 2012-08-08 11:20:34

japenagosc
Member
Registered: 2012-01-19
Posts: 78

Re: [solved] How to? - Samba and shares

W4RH4WK wrote:

sharing folder under Win7 shouldn't be a problem.

i guess you already edited the smb.conf file which holds the configuration for samba. (restart samba after editing the smb.conf)

please tell me, what exactly is not working / what are you trying to achieve but haven't figured out yet.
also posting your smb.conf could help.

another thing that should be mentioned: samba has it's own user database, so the system users under linux are not usable via samba right from the start you need to add them to the smb database manually (see smbpasswd)

Thanks for your answer.

In Win7 is not a problem to share a folder. It is the opposite way that had been a problem. All three PC have the same domain, and i think i've managed it in Samba with a  public folder, that a guest user could access. I used Webmin to accomplish this, but earlier i edited smb.conf myself.

# 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. 
#
#======================= Global Settings =====================================
[global]
	log file = /var/log/samba/%m.log
	load printers = yes
	read raw = no
	write raw = no
	socket options = TCP_NODELAY
	force directory mode = 755
	map to guest = Bad user
	winbind trusted domains only = yes
	encrypt passwords = yes
	public = yes
	winbind use default domain = yes
	allow hosts = 192.168.0.
	dns proxy = no 
	writeable = yes
	path = /home/jaime/public
	workgroup = MYGRP
	force create mode = 755
	os level = 20
	auto services = Compartido
	guest only = yes
	security = share
	max log size = 50
	bind interfaces only = true

# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH

# server string is the equivalent of the NT Description field

# Security mode. Defines in which mode Samba will operate. Possible 
# values are share, user, server, domain and ads. Most people will want 
# user level security. See the Samba-HOWTO-Collection for details.
;   security = share

# 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
;   load printers = yes

# you may wish to override the location of the printcap file
;   printcap name = /etc/printcap

# on SystemV system setting printcap name to lpstat should allow
# you to automatically obtain a printer list from the SystemV spool
# system
;   printcap name = lpstat

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

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

# this tells Samba to use a separate log file for each machine
# that connects

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

# Use password server option only with security = server
# The argument list may include:
#   password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
# or to auto-locate the domain controller/s
#   password server = *
;   password server = <NT-Server-Name>

# Use the realm option only with security = ads
# Specifies the Active Directory realm the host is part of
;   realm = MY_REALM

# 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.
;   passdb backend = tdbsam

# 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.
# Note: Consider carefully the location in the configuration file of
#       this line.  The included file is read at that point.
;   include = /usr/local/samba/lib/smb.conf.%m

# 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 

# 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 = no

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

# 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

# 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 default is NO.

# These scripts are used on a domain controller or stand-alone 
# machine to add or delete corresponding unix accounts
;  add user script = /usr/sbin/useradd %u
;  add group script = /usr/sbin/groupadd %g
;  add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null -s /bin/false %u
;  delete user script = /usr/sbin/userdel %u
;  delete user from group script = /usr/sbin/deluser %u %g
;  delete group script = /usr/sbin/groupdel %g


#============================ Share Definitions ==============================
#[homes]
;   comment = Home Directories
;   browseable = no
;   writable = yes

# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]
;   comment = Network Logon Service
;   path = /usr/local/samba/lib/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
;[Profiles]
;    path = /usr/local/samba/profiles
;    browseable = no
;    guest ok = yes


# NOTE: If you have a BSD-style print system there is no need to 
# specifically define each individual printer
;[printers]
;   comment = All Printers
;   path = /var/spool/samba
;   browseable = no
# Set public = yes to allow user 'guest account' to print
;   guest ok = no
;   writable = no
;   printable = yes

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

# A publicly accessible directory, but read only, except for people in
# the "staff" group
;[public]
;   comment = Public Stuff
;   path = /home/samba
;   public = yes
;   writable = no
;   printable = no
;   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

# A publicly accessible directory, read/write to all users. Note that all files
# created in the directory by users will be owned by the default user, so
# any user with access can delete any other user's files. Obviously this
# directory must be writable by the default user. Another user could of course
# be specified, in which case all files would be owned by that user instead.
;[public]
;   path = /home/jaime/public
;   public = yes
;   only guest = yes
;   writable = yes
;   printable = no

# The following two entries demonstrate how to share a directory so that two
# users can place files there that will be owned by the specific users. In this
# setup, the directory should be writable by both users and should have the
# sticky bit set on it to prevent abuse. Obviously this could be extended to
# as many users as required.
;[myshare]
;   comment = Mary's and Fred's stuff
;   path = /usr/somewhere/shared
;   valid users = mary fred
;   public = no
;   writable = yes
;   printable = no
;   create mask = 0765

When i open Network, the domain appear and i can browse it until i reach the folder i shared, but when i try to open it, it says something like can't mount Windows share...

Thanks once more for your help.

Offline

#5 2012-08-08 11:22:40

japenagosc
Member
Registered: 2012-01-19
Posts: 78

Re: [solved] How to? - Samba and shares

ewaller wrote:

Are you trying to share a folder on your Arch box with your windows box?  Or are you sharing a folder on your windows box, and trying to see it from your Arch box?

What desktop environment are you using?  Do you want to use a GUI filemanager?

The easy way to start is by sharing a folder on the Windows box and trying to connect with something like Dolphin.  All other things being equal, how about if we start there?

Hi, thanks for your answer.

I'm trying to share a folder from Arch to Windows. I have GNOME 3, and i use Webmin too. Earlier i edited the smb.conf file myself and had no luck.

Thanks for your advice.

Offline

#6 2012-08-08 12:21:11

W4RH4WK
Member
Registered: 2012-08-03
Posts: 27

Re: [solved] How to? - Samba and shares

as far as i can tell, i scrolled over your smb.conf

you need to remove the ';' from the entries which define the share. they work like the '#' sign (so everything after it is a comment)

i uploaded one of my smb.conf files which shows how to define a shared folder
https://gist.github.com/3294718

next thing to mention, if you got problems about what a line in smb.conf does, have a look at
http://www.samba.org/samba/docs/man/man … onf.5.html

and last, but not least, i recommend checking out the tool smbclient (it's a very tiny consolebased little client for smb share, which lets you easily test if the share works)

$ smbclient -L localhost

will show you the active shares on your linux box (don't worry about the password, just type in something incorrect to use the guest account)


ps: if you use my config, you might want to remove this line

disable netbios = yes

otherwise your server might not be found under the network section in windows

Last edited by W4RH4WK (2012-08-08 12:23:08)

Offline

#7 2012-08-08 12:41:53

kolombo
Member
From: Ukraine
Registered: 2011-12-14
Posts: 31

Re: [solved] How to? - Samba and shares

One more simple example of smb.conf options

[global]
   workgroup = MYGROUP
   server string = SAMBA

   unix extensions = no
   follow symlinks = yes 
   wide links = yes 

#Define What you need here, share will allow all to connect
   security = share

[share]
comment = working
path = /home/USERNAME/shara
browseable = yes
writable = yes
create mode = 0644
directory mode = 0777
guest ok = yes
public = yes
follow symlinks = yes
wide links = yes

Offline

#8 2012-08-08 12:45:16

W4RH4WK
Member
Registered: 2012-08-03
Posts: 27

Re: [solved] How to? - Samba and shares

guest ok = yes
public = yes

are actually the same according to  http://www.samba.org/samba/docs/man/man … tml#PUBLIC

Offline

#9 2012-08-08 22:52:56

japenagosc
Member
Registered: 2012-01-19
Posts: 78

Re: [solved] How to? - Samba and shares

Hi.

I checked all things you guys told me, and my smb con file is quite simpler now. But it keeps telling me the following thing as long as i try to open a shared folder:

Unable to mount location - failed to mount Windows share

The content of the smb.conf file is:

[global]
   workgroup = NJO
   server string = ArchSamba 
   guest account = nobody

   security = user
   map to guest = Bad User

   netbios name = japc-arch

[Archivos Compartidos]
comment = Compartido
path = /home/jaime/public

browseable = yes
writable = yes

create mode = 0644
directory mode = 0777

guest ok = yes
guest only = yes

Would it be a permissions issue? Thanks for your help.

Last edited by japenagosc (2012-08-09 01:03:48)

Offline

#10 2012-08-09 02:50:18

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,727

Re: [solved] How to? - Samba and shares

let's try this.  What is the output of nmap localhost  ??  (Of course, you may need to install the nmap package)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#11 2012-08-09 11:02:44

japenagosc
Member
Registered: 2012-01-19
Posts: 78

Re: [solved] How to? - Samba and shares

ewaller wrote:

let's try this.  What is the output of nmap localhost  ??  (Of course, you may need to install the nmap package)

Hi,

the output is this:

Starting Nmap 6.01 ( http://nmap.org ) at 2012-08-09 06:01 COT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00030s latency).
Other addresses for localhost (not scanned): 127.0.0.1
rDNS record for 127.0.0.1: localhost.localdomain
Not shown: 999 closed ports
PORT      STATE SERVICE
10000/tcp open  snet-sensor-mgmt

Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds

Offline

#12 2012-08-09 12:34:06

W4RH4WK
Member
Registered: 2012-08-03
Posts: 27

Re: [solved] How to? - Samba and shares

might the samba service not be started?

$ rc.d start samba

should start the samba daemon.

(another way to check this)

# netstat -tulpn | grep smbd 

Offline

#13 2012-08-10 00:01:46

japenagosc
Member
Registered: 2012-01-19
Posts: 78

Re: [solved] How to? - Samba and shares

W4RH4WK wrote:

might the samba service not be started?

$ rc.d start samba

should start the samba daemon.
(another way to check this)

# netstat -tulpn | grep smbd 

Hi.

The process is indeed started. I execute all the time commands such as

rc.d start samba

or

 rc.d restart samba

and this way i can check the changes i've made in smb.conf

The output of netstat... is:

tcp6       0      0 :::445                  :::*                    LISTEN      491/smbd            
tcp6       0      0 :::139                  :::*                    LISTEN      491/smbd   

Offline

#14 2012-08-10 01:32:34

W4RH4WK
Member
Registered: 2012-08-03
Posts: 27

Re: [solved] How to? - Samba and shares

well at least the service is running.

if you type

$ smbclient -L localhost -U guest

is your share listed?

Offline

#15 2012-08-10 02:13:08

japenagosc
Member
Registered: 2012-01-19
Posts: 78

Re: [solved] How to? - Samba and shares

W4RH4WK wrote:

well at least the service is running.

if you type

$ smbclient -L localhost -U guest

is your share listed?

...yep, i think it works...

Anonymous login successful
Domain=[NJO] OS=[Unix] Server=[Samba 3.6.7]

	Sharename       Type      Comment
	---------       ----      -------
	Public Folder   Disk      Archivos Publicos
	IPC$            IPC       IPC Service (ArchSamba)
Anonymous login successful
Domain=[NJO] OS=[Unix] Server=[Samba 3.6.7]

Offline

#16 2012-08-10 04:03:12

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,727

Re: [solved] How to? - Samba and shares

From one of the window boxen, open a file explorer window and enter \\ followed by the IP4 the address of Arch box.  Example:  \\192.168.1.2

Does that work?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#17 2012-08-12 12:52:18

pralias47
Member
From: Melbourne, Australia
Registered: 2011-09-23
Posts: 6

Re: [solved] How to? - Samba and shares

I was wondering if samba might be consistently failing to start correctly, like it does sometimes (and under circumstances not understood by me) when it's being started automatically at boot time.

||~$ ps -ef | grep mbd                                                                              
root       521     1  0 09:04 ?        00:00:00 /usr/sbin/smbd -D                                   
root       524     1  0 09:04 ?        00:00:00 /usr/sbin/nmbd -D                                   
root       557   521  0 09:04 ?        00:00:00 /usr/sbin/smbd -D                                   
firstusr  2624  2607  0 09:28 pts/0    00:00:00 grep mbd

On my system, when samba is working OK, there are always two smbd's and a single nmbd process. When it starts incorrectly, there are still two smbd's, but the nmbd process goes missing. If it's missing on yours, you could try stopping the network and starting samba while the network is down, then check to see if nmbd is running.

In the wiki, near the end, it indicates that you should have the network up and running before starting samba. But on my current system, samba works fine if it's started while the network is down, and it wasn't working so well when I had the network starting first. When I changed rc.conf to put samba in front of the network, I was using netcfg. I've now switched to networkmanager, and samba continues to start correctly.
---------------
Hmm . . What I wrote above now seems irrelevant - systemd decides by itself the starting sequence of everything.

Last edited by pralias47 (2012-08-17 06:42:49)

Offline

Board footer

Powered by FluxBB