SAMBA - Victoria College

Download Report

Transcript SAMBA - Victoria College

SAMBA
Integrating Linux and Window
What is Samba?
• Free suite of programs that enables flavors
of UNIX to work with other operating
systems such as OS/2 and Windows, as both
a server and a client
• As a server, Samba shares Linux files and
printers with Windows systems.
• As a client, Samba gives Linux users access
to files on Windows systems
Shares
• Under Samba, an exported directory
hierarchy is called a share.
• Samba derived from SMB – protocol for
file and printer sharing in Windows
Samba Users, User Maps, and
Passwords
• For a Windows user to gain access to
Samba services on a Linux system, the user
must provide a Windows username and a
Samba password. It is also possible to
authenticate using other methods such as
LDAP or PAM
Usernames
• The supplied username must be the same as a
Linux username or must map to a Linux
username.
• Samba keeps the username maps
in/etc/samba/smbusers.
• Users with the same username on Windows and
Samba do not need to appear in this file, but still
need a Samba password
• When you install Samba, /etc/samba/smbusers has
2 entries:
– root = administrator admin
– Nobody = guest pcguest smbguest
Passwords
• Samba uses Samba passwords, not Linux
passwords to authenticate users.
• When you attempt to connect from Windows to a
Samba server, Windows presents your Windows
username and password to Samba. If your
windows username is the same as or maps to your
Linux username, and if your Windows and Samba
passwords are the same, you do not have to enter a
username and password to connect to the Samba
server.
• Samba keeps passwords in /etc/samba/smbpasswd
To add Samba access for the Win
user sam:
• vi smbusers
sls = sam
• # smbpasswd –a sls
New SMB password:
Retype new SMB password:
Added user sls
Now when sam uses the username sam to log in to
the Samba server, Samba maps sam to sls and
looks up sls in smbpasswd. Sam logs on as sls.
Configuring a Samba Server
• system-config-samba – can set up only basic
features of a Samba server.
• Performs 3 functions:
– Configuration of server
– Configuration of users
– Setting up shares that are exported to Windows
machines
• Overwrites /etc/samba/smb.conf. Make backup
copy before running system-config-samba
Configuring samba using systemconfig-samba
• System-config-samba
– Set workgroup to workgroup in use on
Windows machines.
– Make sure authentication is set to user
– Set encrypted passwords to Yes
– Add Samba users
– Add shares
Swat: Configures a Samba server
• Samba Web Administration Tool – is a browser-based GUI
for the smb.conf file.
• Swat is run from /etc/xinetd.d/swat
• Turn on by changing disable = yes to disable=no.
• Add any remote names or Ips of other systems that will
access swat
• Chkconfig swat on
• Service xinetd restart
• To access, enter http://127.0.0.1:901 or http://localhost:901
Manually configuring a Samba
server
• Edit the /etc/samba/smb.conf
• Can set up:
–
–
–
–
–
–
Global parameters
Security parameters
Logging parameters
Browser parameters
Communication parameters
Share parameters
Sharing user’s home directories
• Often, users like to share their home directories with a
Windows machine. To make this easier, Samba provides
the [homes] share. When you define this share, each user’s
home directory is shared with the specified parameters.
• For example:
[homes]
comment = Home Directories
browseable = no
writable = yes
This prevents users other than the owners from browsing
home directories while allowing logged-in owners full
access.
Accessing Windows Shares from
Linux
• As a client, samba enables you to view and
work with files on a Windows system from
a Linux system.
• smbtree – displays windows shares in a
hierarchical tree. When prompted for a
password, hit enter to view shares available
to guest. Enter password to view restricted
shares.
Smbclient: Connects to
Windows Shares
• Smbclient functions similarly to ftp and
connects to a windows share.
• $ smbclient //PB/mark connects to a
windows share
Mounting Windows Shares
• On the Linux computer, you can mount a
Windows share so that you can write files to
it.
• Mount –t cifs //host/sharedir /share –o
username=mark, password=pizza
• Ls /
Troubleshooting
• Samba provides 3 utilities to troubleshoot a
connection:
– Smbstatus – displays a report on open Samba
connections
– Testparm – checks the syntax of
/etc/samba/smb.conf and displays its contents
– Testprns – checks the validity name of a printer
Troubleshooting
1. Restart the smbd and nmbd daemons
–
Service smb restart
2. Run testparm to check that the smb.conf is
syntactically correct
3. Ping from both sides of the connection to make
sure that the network is up.
4. From Windows, net view \\servername to
display a list of shares available from the server.
5. Try to map the drive with a net use x: \\pb\tmp
Troubleshooting cont.
6. Sbclient –L pb
List all available shares