39
1 Linux Networking and Security Chapter 5

1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

Embed Size (px)

Citation preview

Page 1: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

1

Linux Networking and Security

Chapter 5

Page 2: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

2

Configuring File Sharing Services

Configure an FTP server for anonymous or regular users Set up NFS file sharing between Linux and UNIX

systems Understand NetWare NCP-Based file sharing Use SMB to share files and printers with Windows-based

PCs

Page 3: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

3

Running an FTP server

The File Transfer Protocol (FTP) was designed for efficient distribution of a single file to multiple remote clients

Some design characteristics of FTP: FTP operates in real-time FTP was designed to be used by the public and this is called

anonymous FTP FTP is very effective for transferring large files FTP was not designed as a “shared local disk”

Page 4: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

4

Using an FTP Client

Accessing an FTP site requires an FTP client Linux includes a text-mode FTP client, some Linux

systems include a newer and refined text-mode ftp system called ncftp

An FTP client session begins with the ftp command If the system connects, users are prompted for username and

password

Page 5: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

5

Using an FTP Client

Page 6: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

6

Using an FTP Client

Page 7: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

7

Using an FTP Client

Page 8: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

8

Using an FTP Client

Page 9: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

9

Introducing FTP Servers

The most widely used FTP server on Linux is the Washington University server, wu-ftp

Setting up the FTP server is done via a number of configuration files

In addition to configuration files, there is the anonymous user home directory: Anonymous users do not see the entire file system and are

limited to a working area, or home directory that designates downloadable files

Page 10: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

10

Introducing FTP Servers

Page 11: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

11

Setting Up FTP Configuration Files

The FTP server is configured using the ftpaccess file in the /etc directory There are three types of FTP users: Anonymous, Real, and

Guest Classes of users can be created, which allow you to assign

permissions based on groupings Permit FTP users to perform file actions using a series of

directives naming the file action, followed by yes or no, followed by the classes of user to which the directive applies

Page 12: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

12

Setting Up FTP Configuration Files

Page 13: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

13

Setting Up FTP Configuration Files

Page 14: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

14

Sharing Files with NFS

The Network File System (NFS) provides access to remote files systems as if they are part of the local directory structure NFS was designed for permanent, long-term connections where

remote file systems are used as part of the regular user environment

NFS does have security concerns and was designed with a trusted network in mind

NFS is UNIX-centric and does not typically perform well with Windows or NetWare servers

Page 15: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

15

Running the NFS Daemons

The NFS protocol is implemented by several daemons, each handling different tasks

NFS communication is built on the remote procedure call (rpc) system This system functions almost like a superserver in that programs

are assigned an rpc number A program called portmap watches for rpc requests from

programs like NFS daemons, then maps them to TCP or UDP ports

NFS uses the rpc.mountd daemon to make new connections

Page 16: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

16

Accessing Remote NFSFile Systems

Acting as a client to an NFS server is straightforward; use the mount command for any local hard disk partitioning containing a file system needing access The mount point must be created and the host must have

allowed mounting of the directory Mount options include altering the default buffer size for NFS

transfers, read-only or read-write permission, hard or soft mounts, and suppressing automatic mounting at system startup

Page 17: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

17

Exporting Your File SystemUsing NFS

To make parts of your file system accessible over the network to other systems, NFS daemons must be running and NFS traffic must be allowed to pass between the hosts Beyond this, the /etc/exports file must be set up to define which

of the local directories will be available to remote users and how each is used

NFS uses a security concept called squashing to prevent a user from gaining access to a user account (especially to the root account) simply because they have an ID on the NFS client

Page 18: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

18

NetWare File and Printer Sharing

NetWare protocols can be used on Linux to act as NetWare file and print servers, or as a client to other NetWare servers To use either the client or server tools for NetWare, IPX must be

installed on Linux NetWare uses a transport protocol called the NetWare Core

Protocol (NCP) NetWare is a dedicated network operating system, but in the

context of Linux, these servers are limited to file and printer sharing

Page 19: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

19

Accessing NetWare Serversas a Client

The ncpfs package implements NCP and provides a number of client utilities allowing log in, file transfer, printing and so forth The ncpfs package is not installed by default The ncpfs utilities allow the specification of command-line

parameters for server contact Alternatively, create a .nwclient file in the home directory that

contains the NetWare default settings

Page 20: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

20

Accessing NetWare Serversas a Client

Page 21: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

21

Making Linux Into aNetWare Server

Most Linux distributions contain a package that lets a system emulate a NetWare server The Martin Stovers NetWare Emulator package (mars-nwe)

provides NetWare-specific protocols In addition to NCP transport protocol, mars-nwe provides the

NetWare Routing Information Protocol (RIP) and the Service Addressing Protocol (SAP) that let Linux act as a peer with other NetWare servers

Configure mars-nwe using the /etc/nwserv.conf

Page 22: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

22

Windows File and Print Integration with Samba

To implement the Windows-based protocols such as Server Message Block (SMB), Common Internet File System (CIFS) and NetBIOS in Linux, use the Samba suite The server portion of Samba allows a Linux system to appear in

Windows networks as if it were another Windows system The client portions of Samba also let Linux access Windows

systems that are configured to share their resources

Page 23: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

23

Using Samba Client Utilities

Samba client utilities allow access to shared Windows resources as if another Windows-based computer The smbclient utility is a command-line utility that allows logging

into a Windows host, and interacting using a series of commands

To graphically access a Windows system, mount a Windows share as part of Linux by the standard mount command using a file system type of smbfs

Printing to a Windows printer is done using the smbprint command

Page 24: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

24

Using Samba Client Utilities

Page 25: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

25

Using Samba Client Utilities

Page 26: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

26

Using Samba Client Utilities

Page 27: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

27

Using Samba Client Utilities

Page 28: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

28

Setting Up a Samba Server

Samba includes two server daemons: nmbd, which implements the NetBIOS service smbd, which implements the SMB file and print sharing Both of these daemons must be running to implement a Samba

server Both are managed using a single script in /etc/rc.d/init.d

Samba configuration files are typically stored in /etc/samba

Page 29: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

29

Creating Samba Users

The user security model requires users to log in with a valid user name and password before using a share on the Samba server Several utilities included with the Samba suite allow for everyone

with a Linux user account to also log in via Samba The following command creates a Samba password for all Linux

users:cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd

Page 30: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

30

Using SWAT to Configure SMB

SWAT is a browser-based graphical interface that sets up the smb.conf file, restarts the Samba server, and provides some status information on server utilization SWAT runs a network service managed by the superserver To use SWAT, the SWAT service must be included in the

/etc/services file SWAT must also be enabled in the superserver configuration

Page 31: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

31

Using SWAT to Configure SMB

Page 32: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

32

Using SWAT to Configure SMB

Page 33: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

33

Using SWAT to Configure SMB

Page 34: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

34

Accessing Samba from Windows

Once a Samba server is up and running, there is access to Linux files and printers from any Windows-based host All that is required is the correct Windows networking

configuration and a valid username and password Samba uses only TCP/IP, so TCP/IP should be configured in the

Windows environment

Page 35: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

35

Accessing Samba from Windows

Page 36: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

36

Chapter Summary

FTP is a widely used Internet protocol that was designed for efficient transfer of files from a server to multiple clients at diverse locations

The anonymous feature of FTP makes it popular for public download archives

To access an FTP server, you can use the text-mode client, ftp, graphical clients such as gFTP or IglooFTP, or a Web browser

The standard FTP server is wu-ftpd You can configure classes of users in ftpaccess, then assign

permissions to perform different file actions

Page 37: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

37

Chapter Summary

The Network File System (NFS) lets you access remote file systems as part of your local directory structure by using the mount command to contact an NFS server

An NFS server consists of several possible daemons; at the least, nfsd and rpc.mountd are required

An NFS server is configured using the /etc/exports file, which defines which local directories are available for remote users to mount

NFS is prone to security holes, but it relies on several layers of security

Page 38: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

38

Chapter Summary

The NetWare network operating system can be emulated on Linux as a powerful file-and-print server using the mars-nwe package

The mars-nwe NetWare emulator is configured using the /etc/nwserv.conf file

Linux can access NetWare servers as clients using the ncpfs package, which provides a number of command-line tools to manage NetWare servers

Windows networking uses the NetBIOS and SMB (also called CIFS) protocols, both of which are implemented by the Samba suite in Linux

Page 39: 1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file

39

Chapter Summary

Using the Samba client utility smbclient and mounting Windows file systems of type smbfs provide convenient access to shared resources

A simple Samba server configuration in smb.conf involves defining the server name, basic security options, and defining shares

SWAT provides graphical configuration and administration functionality for Samba

Multiple Samba security models are supported, including Windows NT domains and guest accounts, which often use Samba as a dedicated print server