Samba setup

From Smith family
Jump to: navigation, search
Server setup
← Previous Next →
Git Log stats

Samba allows me to grant access to Linux shares from Windows machines. This setup is done on the desktop machine.

  • Install the packages you need
root@desktop:~# apt-get install samba
  • Modify /etc/samba/smb.conf (note that you'll have to skip around the file to find all the settings)
[global]

  min protocol = SMB2

## Browsing/Identification ### 

# Change this to the workgroup/NT-domain name your Samba server will part of
  workgroup = myworkgroup

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

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

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

# 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
# This might need tweaking when using external authentication schemes
   valid users = %S
  • For each user, create the password for that user
root@desktop:~# smbpasswd -a linuxusername
  • Add the user entries into /etc/samba/smbusers
linuxusername1 = "sambausername1"
linuxusername2 = "sambausername2"
Note that the quotes are important. This allows someone to log in using sambausername1 and gain access to linuxuername1's home directory on the Ubuntu desktop machine
  • Restart Samba:
root@desktop:~# /etc/init.d/samba restart

Note that each user will need to log into the Samba server machine directly (i.e. via the GUI at that machine) to go through the 'first login mandatory password reset' rigmarole. Once that's done, they'll be able to use their Samba share.

On the Windows side, the user should point Windows Explorer at \\server\username and give the Samba username and password to log in. They can then map a new network drive to the Samba directory if they want.

See also

Here are a few pages that are useful guides or provide background and context.