RSS

Tag Archives: Samba configuration file

Installing Samba Server on Ubuntu – Breaking News

Disillusioned with the lack of progress so far, I went back and made sure I had done everything perfectly.

Turns out I hadn’t.

I’ve made the edit to my post – Part III – and realised the error of my ways.

I had made “browseable=yes” commented out in the config file.

This means that when my Mac was looking for it, it couldn’t find it because I was “browsing” for it and that isn’t allowed. So, since I took out the comment symbol, meaning that the browseable=yes was then actually a setting, I can now find the folder and added it to my Mac!!!

Very happy.

I still have to do a few things to get the Mac looking at a hard drive on the Ubuntu machine, but baby steps, right?

Also, I wanted to quickly elucidate on the ping thing.

On the Mac, I opened the Terminal window (Lauchpad – Other – Terminal, which looks like a grey box with a black background and a cursor on it) and typed in the following:

ping kbfileserver.local

At first it gave me weird messages about how it couldn’t find anything, but then I remembered I had turned off the wireless on the ubuntu machine. I turned it back on and tried again. It then started giving me messages about how many microseconds it took to return the ping. I got excited.

I found this in Wikipedia about “ping” and thought it was a good explanation:

Ping is a computer network administration utility used to test the reachability of a host on an Internet Protocol (IP) network and to measure the round-trip time for messages sent from the originating host to a destination computer. The name comes from active sonar terminology which sends a pulse of sound and listens for the echo to detect objects underwater.

So I guess, the good thing is to have a notification including the time given to you which would mean that the message has actually been there, connected and returned. If it doesn’t connect, and therefore can’t transmit the message, it will also tell you. This way it’s easy to tell if the other machine is at all visible.

Anyway, I now need to find out the rest of the information I need to set the hard drives up, but more on that tomorrow.

 

Advertisements
 
Leave a comment

Posted by on February 7, 2014 in Nerdy Computer Stuff

 

Tags: , , , , , , , , ,

Installing Samba Server on Ubuntu Part IV

The next step in trying to fix this is now back to the terminal window and trying to get this thing connecting.

From the ubuntu boards, Morbius1 has suggested:

  • [4] Then I want to create a “Samba” directory away from your home directory.
sudo mkdir -p /Samba/Public

I’ve just gone into my Terminal window (remember it’s Crtl-Alt-T) and typed this in.

Looking at the command, again we see the power word “sudo” and the command “mkdir” could possibly be MaKe DIRectory. The “-p” could be anything, but I’ve noticed that there are other ones too, like “-a”, but I don’t know what they mean. I’m assuming it’s some sort of formatting command. Lastly, the /Samba/Public must be the actual name of the directory (or folder) that’s being created here.

I sure hop it worked, because the Terminal just asked me for my sudo password and then spat me back to the cursor. I’m assuming no news is good news.

  • Then change permissions so that anyone can access it:
sudo chmod 777 /Samba/Public

This is typed in the terminal window. Power word sudo, as usual. The chmod 777 is tricky, but I’m think the mod is short for modification, so that kinda makes sense – the 777 I believe is the setting for the modification. I don’t know much about this, but I looked it up on Wikipedia and it seems I was wrong. Chmod is short for CHange MODe. And the numbers are about permissions. This is a little off track, but interesting…

# Permission rwx
7 full 111
6 read and write 110
5 read and execute 101
4 read only 100
3 write and execute 011
2 write only 010
1 execute only 001
0 none 000

I don’t know about this rwx thing, but the fact that each of the 7’s give full permissions, seems like a pretty solid thing to do. Hang I just worked it out. r = read, w = write and x = execute. Therefore, it seems that the 777 means that we’re setting full permissions to read, write and execute (execute = run or start up).

I put that into the terminal and it didn’t care. Again, assuming no news is good news.

  • [5] I want to create the simplest possible share at the bottom of smb.conf as the only share on this box:
[public]
path = /Samba/Public
guest ok = yes
read only = no
force user = keith

I’m getting a bit dizzy going back and forth between the Terminal and the pop-up conf edit window, but it seems necessary.

I’ve opened the conf window again using the command as I did in the last post:

sudo gedit /etc/samba/smb.conf

I didn’t want to just whack it in, so I did a little comment of my own and added the code as suggested above.

# This section added for troubleshooting connection
# 
[public]
path = /Samba/Public
guest ok = yes
read only = no
force user = keith

I then saved the conf file by pressing the save button in the menu bar of the pop up window. When I’m back in the Terminal, I’ll do the next step.

  • [6] Then restart some services:
sudo service smbd restart
sudo service nmbd restart

As you may recall, we went through all about these “daemon” things that are the little services that run all of the samba stuff in the background. We’ve made changes to the config and other things, so we should start these running again so any changes can be picked up. Sudo, power word. “Service smbd” or “Service nmbd” are the file names of the services and, I assume, the type (eg service). Restart is pretty straight forward.

After entering the above into the Terminal window and hitting enter after each line, I got the following responses:

smbd stop/waiting

smbd start/running, process 4040

 

nmbd stop/waiting

nmbd start/running, process 4054

That done, onto the last step as offered on the forum…

  • [6] Then we’ll see if the Linux box itself can access it’s own samba share with the following command in the terminal:
nautilus smb://kbfileserver.local/public

This is starting to look a little scary now, because I’m not quite sure if there are steps I should be doing. I’m writing this post as I’m doing the tutorial, so I hope I’m doing it right!

Alright, done. Some, I think, positive results. Firstly, there isn’t anything that happens when you type the above in – you end up at the cursor with no message. However, when I first did it, it gave me a pop up error message that said I couldn’t connect.

Then I remembered that I had turned the wireless off. I reconnected to the network and typed the line in again. This time there still wasn’t a message, but there was a whiring of the hard drive – it seemed that something was happening.

I noticed that the “files” tab on the desktop was highlighted as if I had opened a screen. I clicked on the icon and it happily looks like I am now connected to that folder through the network. This is kinda of cool. It really seems like we’re getting somewhere.

  • [7] If that works we can see if you can do the same thing from the mac using “guests” not “keith” as the “Connect As” user.

Just when I was doing so well. I don’t really know what this step means, and further, I don’t know how to do it. Bear with me while I try to battle my way through it.

I’ve gone to my Mac and clicked on the Finder program to bring it up. Then I’ve gone to the menu bar at the top and clicked on Go to get the drop down for “Connect to Server”. Currently I have two connections set up – neither work – as recommended earlier in my posts.

  • smb://keith@kbfileserver.local/keith
  • smb://kbfileserver.local/keith

The kbfileserver.local/keith seems to be very similar to the one I got nautilus to set up above. So I doubled clicked on it and it gave me the not connected error message.

There is something I can try though – and it may be what I’m supposed to do. Morbius1 has said I should connect using “guests” not “keith” so that might be where it could work.

Unfortunately, this didn’t seem to work. I typed in:

  • smb://kbfileserver.local/guest

And it gave me:

  • There was a problem connecting to the server “kbfileserver.local”

I also tried both “guest” and “guests” to no avail. I’m thinking that I’m getting close, but not quite there yet.

I have just jumped back to the forum to see that Morbius1 has made a comment, so I had some other things to try.

  • The same as above, but instead of guest, I should be writing “public” – which makes sense because that’s what we called the folder.
  • I should try pinging from the Mac to see if it connects.

The “public” thing didn’t work and the ping gave this error:

ping: cannot resolve kbfileserver.local: Unknown host

(By the way, the Terminal window on the Mac is on the launchpad under “Other”. You just click on it and it opens the terminal window.)

I’ll report back to the forum and see what comes out of my results.

 

 

 

 
Leave a comment

Posted by on February 7, 2014 in Nerdy Computer Stuff

 

Tags: , , , , , , , , ,

Installing Samba Server on Ubuntu Part III

The next instalment is possible due to more help on the ubuntu forum. Again Morbius1.

  • [1] Post your entire smb.conf since I really don’t know where you are any more. You can do that by issuing this command and posting it’s output to the forum:
cat /etc/samba/smb.conf

To that I replied…

#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# 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 most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
#  – When such options are commented with “;”, the proposed setting
#    differs from the default Samba behaviour
#  – When commented with “#”, the proposed setting is the default
#    behaviour of Samba but the option is considered important
#    enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# “testparm” to check that you have not made any basic syntactic
# errors.
# A well-established practice is to name the original file
# “smb.conf.master” and create the “real” config file with
# testparm -s smb.conf.master >smb.conf
# This minimizes the size of the really used smb.conf file
# which, according to the Samba Team, impacts performance
# However, use this with caution if your smb.conf file contains nested
# “include” statements. See Debian bug #483187 for a case
# where using a master file is not a good idea.
#
#======================= Global Settings =======================
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP
# server string is the equivalent of the NT Description field
   server string = %h server (Samba, Ubuntu)
# Windows Internet Name Serving Support Section:
# WINS Support – Tells the NMBD component of Samba to enable its WINS Server
#   wins support = no
# 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
# This will prevent nmbd to search for NetBIOS names through DNS.
   dns proxy = no
# What naming service and in what order should we use to resolve host names
# to IP addresses
;   name resolve order = lmhosts host wins bcast
#### Networking ####
# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
;   interfaces = 127.0.0.0/8 eth0
# Only bind to the named interfaces and/or networks; you must use the
# ‘interfaces’ option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself.  However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
;   bind interfaces only = yes
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
   log file = /var/log/samba/log.%m
# Cap the size of the individual log files (in KiB).
   max log size = 1000
# If you want Samba to only log through syslog then set the following
# parameter to ‘yes’.
#   syslog only = no
# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
   syslog = 0
# Do something sensible when Samba crashes: mail the admin a backtrace
   panic action = /usr/share/samba/panic-action %d
####### Authentication #######
# “security = user” is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
security = user
username map = /etc/samba/smbusers
# You may wish to use password encryption.  See the section on
# ‘encrypt passwords’ in the smb.conf(5) manpage before enabling.
   encrypt passwords = true
# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
   passdb backend = tdbsam
   obey pam restrictions = yes
# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
   unix password sync = yes
# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n
*password\supdated\ssuccessfully* .
# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# ‘passwd program’. The default is ‘no’.
   pam password change = yes
# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
   map to guest = bad user
########## Domains ###########
# Is this machine able to authenticate users. Both PDC and BDC
# must have this setting enabled. If you are the BDC you must
# change the ‘domain master’ setting to no
#
;   domain logons = yes
#
# The following setting only takes effect if ‘domain logons’ is set
# It specifies the location of the user’s profile directory
# from the client point of view)
# The following required a [profiles] share to be setup on the
# samba server (see below)
;   logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user’s home directory
# (this is Samba’s default)
#   logon path = \\%N\%U\profile
# The following setting only takes effect if ‘domain logons’ is set
# It specifies the location of a user’s home directory (from the client
# point of view)
;   logon drive = H:
#   logon home = \\%N\%U
# The following setting only takes effect if ‘domain logons’ is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in ‘DOS’ file format convention
;   logon script = logon.cmd
# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe.  The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser –quiet –disabled-password –gecos “” %u
# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a “machines” group exists on the system
; add machine script  = /usr/sbin/useradd -g machines -c “%u machine account” -d
/var/lib/samba -s /bin/false %u
# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup –force-badname %g
########## Printing ##########
# If you want to automatically load your printer list rather
# than setting them up individually then you’ll need this
#   load printers = yes
# lpr(ng) printing. You may wish to override the location of the
# printcap file
;   printing = bsd
;   printcap name = /etc/printcap
# CUPS printing.  See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
;   printing = cups
;   printcap name = cups
############ Misc ############
# 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 = /home/samba/etc/smb.conf.%m
# Most people will find that this option gives better performance.
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html
# for details
# You may want to add the following on a Linux system:
#         SO_RCVBUF=8192 SO_SNDBUF=8192
#   socket options = TCP_NODELAY
# The following parameter is useful only if you have the linpopup package
# installed. The samba maintainer and the linpopup maintainer are
# working to ease installation and configuration of linpopup and samba.
;   message command = /bin/sh -c ‘/usr/bin/linpopup “%f” “%m” %s; rm %s’ &
# Domain Master specifies Samba to be the Domain Master Browser. If this
# machine will be configured as a BDC (a secondary logon server), you
# must set this to ‘no’; otherwise, the default behavior is recommended.
#   domain master = auto
# Some defaults for winbind (make sure you’re not using the ranges
# for something else.)
;   idmap uid = 10000-20000
;   idmap gid = 10000-20000
;   template shell = /bin/bash
# The following was the default behaviour in sarge,
# but samba upstream reverted the default because it might induce
# performance issues in large organizations.
# See Debian bug #368251 for some of the consequences of *not*
# having this setting and smb.conf(5) for details.
;   winbind enum groups = yes
;   winbind enum users = yes
# Setup usershare options to enable non-root users to share folders
# with the net usershare command.
# Maximum number of usershare. 0 (default) means that usershare is disabled.
;   usershare max shares = 100
# Allow users who’ve been granted usershare privileges to create
# public shares, not just authenticated ones
   usershare allow guests = yes
#======================= Share Definitions =======================
# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user’s home director as \\server\username
[homes]
comment = Home Directories
browseable = yes
# By default, the home directories are exported read-only. Change the
# next parameter to ‘no’ if you want to be able to write to them.
read only = yes
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
;   create mask = 0700
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
;   directory mask = 0700
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only “username” can connect to \\server\username
# The following parameter makes sure that only “username” can connect
#
# This might need tweaking when using external authentication schemes
valid users = %S
# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
;   comment = Network Logon Service
;   path = /home/samba/netlogon
;   guest ok = yes
;   read only = yes
# Un-comment the following and create the profiles directory to store
# users profiles (see the “logon path” option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
;   comment = Users profiles
;   path = /home/samba/profiles
;   guest ok = no
;   browseable = no
;   create mask = 0600
;   directory mask = 0700
[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700
# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace ‘lpadmin’ with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
;   write list = root, @lpadmin
# A sample share for sharing your CD-ROM with others.
;[cdrom]
;   comment = Samba server’s CD-ROM
;   read only = yes
;   locking = no
;   path = /cdrom
;   guest ok = yes
# The next two parameters show how to auto-mount a CD-ROM when the
#cdrom share is accesed. For this to work /etc/fstab must contain
#an entry like this:
#
#       /dev/scd0   /cdrom  iso9660 defaults,noauto,ro,user   0 0
#
# The CD-ROM gets unmounted automatically after the connection to the
#

The next step after that was to carry out a set of instructions – changes to the conf file. I’m kinda starting to get this all now – the conf file is where all the configuration is set up and it’s a matter of making some changes there to fix the problem. I just have to remember to open the conf file in the pop up window – it’s not in the same place as the Terminal window.

  • [2] What I’m going to suggest is removing the [homes] share entirely. It’s introducing a level of complexity that’s just getting in the way at the moment.

Okay, so this means I have to remember how to bring up the pop up conf file window. Looking back at my previous posts, I have to do this to bring up the window:

sudo gedit /etc/samba/smb.conf

So again, I assume this is the power-word “sudo” to be able to change the file and “gedit” is some sort of edit command. The file path (location) of the configuration file (smb.conf) is the last part of the command.

Looking at the code in the window that comes up, I’m trying to work out which section to remove entirely. I mean I get what Morbius1 is saying – I think. Each section seems to start with a parenthetical title (eg, [homes] or [global]) so I’m going to assume that Morbius1 is saying to delete everything starting with [homes] and ending just before the next bracketed title.

That looks like this:

 # user’s home director as \\server\username

[homes]
comment = Home Directories
browseable = yes
# By default, the home directories are exported read-only. Change the
# next parameter to ‘no’ if you want to be able to write to them.
read only = yes
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
;   create mask = 0700
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
;   directory mask = 0700
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only “username” can connect to \\server\username
# The following parameter makes sure that only “username” can connect
#
# This might need tweaking when using external authentication schemes
valid users = %S

*** EDIT: UPDATE ***

I got this wrong when I did this part and paid for it later. However, at least I know where I went wrong and that’s great news.

Above where it says “browseable = yes” – don’t comment that one out. Keep it in. That was my big mistake.

It’s impossible for my Mac to find the folder because I’ve told the config file that I don’t want people (like my Mac) to be able to browse for it!

*** END EDIT: UPDATE ***

The next part seemed to be part of another section [net logon] or something. But the actual title bit had a semi-colon against it. Thinking back, I believe this means it’s been commented out. And if you remember my previous post, this means that it won’t be read by the computer and therefore almost deleted, but there for reference.

That got me to thinking that maybe I could just put in semi-colons instead of deleting stuff from my .conf file. That seems to make much more sense because I can always include it again if I need to. Glad I didn’t just jump and delete that!

This means that [homes], comment= and valid users= have now been commented out and no longer apply to the config. Done. 🙂  [** Edit: I have removed the browseable=yes part from here **]

The next instruction is:

  • [3] Then I want to add a line in the [global] section – right under the workgroup line:
name resolve order = bcast host lmhosts wins

The global section is right at the top, so pretty easy to find. I will add it in under the following:

[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP

Now that’s done and I can finish off with the conf file. To do that I have to save the pop up window. I found Save in the menu bar at the top, so that worked out well. Once saved, I closed the window with the red X and then it took me back to the Terminal window.

There’s more to do yet, but that’s the next post…

 
1 Comment

Posted by on February 7, 2014 in Nerdy Computer Stuff

 

Tags: , , , , , , , , ,

 
%d bloggers like this: