Lab #10: Using Linux with Microsoft Windows

Similar documents
Install and Configure Samba - CentOS 7

CIS 192 Linux Lab Exercise

Implementing a Primary Domain Controller for Windows 2000 Clients using Samba

CTEC1863/2018F Bonus Lab Page 1 of 5

Sharing files and printers with Microsoft Windows

Network-based File Sharing (1)

Lab #9: Configuring A Linux File Server

Chapter 6: Connecting Windows Workstations

SIEMENS UserAdmin Workshop TELEPERM XP Version 4 Chapter 1

CS Fundamentals of Programming II Fall Very Basic UNIX

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys

Lab 1 Introduction to UNIX and C

Perl and R Scripting for Biologists

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

15. Creating a Samba Server in Knoppix v.3

Installing QuickBooks Enterprise Solutions Database Manager On Different Linux Servers

WM_W60X_SDK_GCC Compiling Guide V1.1

Systems Programming and Computer Architecture ( ) Exercise Session 01 Data Lab

Setting Up SAMBA. And the response was: salmonberry samba sawtimber scramble. Thus, the name Samba was born.

Computer Systems and Architecture

Software Tips-1. Soma s Software Tips. Software Tips for the X-Ray Facility

RHCE BOOT CAMP. File Sharing Services. Wednesday, November 28, 12

Introduction to Linux Environment. Yun-Wen Chen

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Linux Exercise. pwd answer: We call this directory (into which you get when you log in) your home directory.

Linux Essentials Objectives Topics:

Getting Started With UNIX Lab Exercises

Student Remote Login Procedure (see picture below): 1. Start SSH Secure Shell 2. Click the computer icon (4 th on the toolbar) 3.

Step by Step Gluster Setup Table of Contents

MTU Computer Structure

LAB #7 Linux Tutorial

Introduction to Linux

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

Set 1 MCQ Which command is used to sort the lines of data in a file in reverse order A) sort B) sh C) st D) sort -r

Offloading NDO2DB To Remote Server

Lab #5 Guide: Installing Ubuntu as a Virtual Machine

Linux Command Line Primer. By: Scott Marshall

Configuring and Troubleshooting MS DFS links in an HP CIFS Server (Samba) Environment

Linux Administration

Network Monitoring & Management. A few Linux basics

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

mkdir Phys338 s2017 Draw the tree of the directories and files for this step and all the following cd Phys338 s2017

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Orchid Core VMS Installation Guide

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Common UNIX Commands. Unix. User Interfaces. Unix Commands Winter COMP 1270 Computer Usage II 9-1. Using UNIX. Unix has a command line interface

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

Obtaining and Installing the Updated TSBroadcaster Scripts

Linux Systems Administration Getting Started with Linux

CIFS ON OPENVMS. Tips and Hints. Paul Bakker, Hans Hosang. Platform Integration Competency Center.

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Working with Basic Linux. Daniel Balagué

IBM Iseries linux technical solutions v5r.

ITEC451 Network Design & Analysis Laboratory Guide: Appendix

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14

Samba. Alain Knaff. Linuxdays, Samba. Alain Knaff. Installing. Basic config PDC. Printing. Misc gimmicks. Conclusion

Network-based File Sharing

Virtual Data Center (vdc) Manual

Computer Systems and Architecture

Applied Biosystems SQL*LIMS Technical Support Technical Note

ClearCase and Samba. A Supported Configuration. Lonnie Roscillo and Sue Meany. December 12, ClearCase Support Whitepaper

Assignment 1: Build Environment

Data Management at ARSC

SIOS Protection Suite for Linux v9.0. Samba Recovery Kit Administration Guide

Lab #9: Basic Linux Networking

EE516: Embedded Software Project 1. Setting Up Environment for Projects

Part I. Introduction to Linux

Lab 2A> ADDING USERS in Linux

Chapter-3. Introduction to Unix: Fundamental Commands

Introduction of Linux

CSE Linux VM. For Microsoft Windows. Based on opensuse Leap 42.2

CS CS Tutorial 2 2 Winter 2018

Exercise 1: Basic Tools

1. Open VirtualBox and start your linux VM. Boot the machine and log in with the user account you created in Lab #1. Open the Terminal application.

Unix Introduction to UNIX

Networks Lab Pod Diagram

Introduction to UNIX/Linux

Unix Basics. Systems Programming Concepts

Lab Working with Linux Command Line

INSE Lab 1 Introduction to UNIX Fall 2017

CS370 Operating Systems

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

Stop all processes and then reboot - same as above startx. Log in as superuser from current login exit

Introduction to Linux. Fundamentals of Computer Science

Linux at the Command Line Don Johnson of BU IS&T

configure samba for some basic file service tasks

Copyright Heraflux Technologies. Do not redistribute or copy as your own. 1

Introduction to Linux

Introduction to Unix and Linux. Workshop 1: Directories and Files

SIOS Protection Suite for Linux Samba Recovery Kit v9.2. Administration Guide

Getting your department account

SIOS Protection Suite for Linux Samba Recovery Kit v Administration Guide

SQL Server Administration on Linux 2017

Introduction to the UNIX command line

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Parts of this tutorial has been adapted from M. Stonebank s UNIX Tutorial for Beginners (

Transcription:

CTEC1863/2017F Lab #10 Samba Page 1 of 11 Lab #10: Using Linux with Microsoft Windows In this lab, we turn Linux into a Microsoft Windows network server using Samba, "the free SMB and CIFS client and server for UNIX and other operating systems." Source: samba-3.0.11/readme For more information about Samba, read the online documentation: http://www.samba.org/ (official Samba web site) PART A: Installing the Samba Server on Linux 1. Start your CentOS VM. 2. Become root. Make sure that Samba is installed: yum install samba samba-client samba-common 3. Enable Samba in the firewall: firewall-cmd --permanent --zone=public --add-service=samba firewall-cmd --reload 4. The CentOS Samba configuration file is /etc/samba/smb.conf. Make a backup first: cd /etc/samba/ cp smb.conf smb.conf.old Using gedit (or another text editor, as root), search for the settings in the existing smb.conf file. Use your surname/last name/family name in all capital letters as the "netbios name". This will become the name of the Linux Samba server on a Microsoft Windows network. NOTE: Remove any leading semicolons (;) in configuration lines -- those are Samba comments.

CTEC1863/2017F Lab #10 Samba Page 2 of 11 4. (continued) For example, a user named Goran Jankovic would use JANKOVIC as the netbios name. We will all use the workgroup COMPENG. [global]... workgroup = COMPENG... netbios name = YOURSERVERNAME... [homes]... writable = yes... [shared] comment = Shared Folder path = /home/shared public = yes writable = yes browseable = yes After making the necessary edits, save the file. 5. Create your shared folder. It is best to give it "shared" permissions (like /tmp). For example, mkdir -p /home/shared chmod 1777 /home/shared 6. SELinux ("Security Enhanced Linux") is a service that runs to allow fine-grained control of which files can be accessed, etc. You must allow Samba in SELinux: chcon -t samba_share_t /home/shared setsebool -P samba_enable_home_dirs 1 Also copy at least one file into the folder, so that you can properly test it.

CTEC1863/2017F Lab #10 Samba Page 3 of 11 7. After making the necessary edits, save the file. Prepare to run Samba: testparm (validate the configuration) The testparm program should not produce any error messages. If so, you probably have one or more errors in your smb.conf file. 8. Continue to prepare to run Samba: smbpasswd -a yourusername (add yourself as a Samba user) systemctl enable nmb.service smb.service (start the servers) systemctl restart nmb.service smb.service ps -ef grep mbd (verify servers are running) OR systemctl status nmb.service systemctl status smb.service (get server status) Note: If you make a change to your smb.conf file, you must notify the Samba server processes by sending a "Hangup" signal with the kill command. For example, # ps -ef grep mbd root 18881 1 0 10:58? 00:00:00 /usr/local/samba/sbin/nmbd -D root 18883 1 0 10:58? 00:00:00 /usr/local/samba/sbin/smbd -D root 18972 1087 0 11:10 pts/1 00:00:00 grep mbd # kill -HUP 18881 18883 You can also just restart the two services: systemctl restart nmb.service smb.service

CTEC1863/2017F Lab #10 Samba Page 4 of 11 9. Add an entry to your /etc/hosts file for your Samba server name. (Make a backup first and then use a text editor.) For example: 192.168.3.191 jankovic jankovic.compeng Get your CentOS static IP address using the ip a command. After you save the hosts file, test by ping-ing both hostnames. (Ctrl-C to stop ping.) 10. (a) Test your Samba server using a Linux client: smbclient -N -L //YOURSERVERNAME For example, smbclient -N -L //JANKOVIC Anonymous login successful Domain=[COMPENG] OS=[Unix] Server=[Samba 4.1.0] Sharename Type Comment --------- ---- ------- IPC$ IPC IPC Service (Samba 4.1.0) homes Disk shared Disk Anonymous login successful Domain=[COMPENG] OS=[Unix] Server=[Samba 4.1.0] Server Comment --------- ------- JANKOVIC Samba 4.1.0 Workgroup Master --------- ------- COMPENG JANKOVIC (b) You can also use your IP address. For example: smbclient -N -L //192.168.3.191 Anonymous login successful Domain=[COMPENG] OS=[Unix] Server=[Samba 4.1.0]... (c) Test Samba access to your home directory: smbclient -U yourusername //yourservername/yourusername...continued...

CTEC1863/2017F Lab #10 Samba Page 5 of 11 10....continued... After connecting, if you run a dir command, you should see the files in your home directory. (d) In another window, as your non-root user, run the Samba client: smbclient //yourservername/yourusername You should see the same result as in step (c). (e) Test Samba access to your shared directory: smbclient //yourservername/shared For example, if the user Goran has a Linux username "goranj", then goranj would be his username for Samba and for Microsoft Networking. # smbpasswd -a goranj The system administrator would have New SMB password: run this command (once) on the server; Retype new SMB password: you don t have to do this on the client Added user goranj. $ smbclient //jankovic/goranj Run this command on the client or server Password: Domain=[COMPENG] OS=[Unix] Server=[Samba 3.0.11] smb: \> ls. D 0 Tue Jul 20 11:21:29 2015.. D 0 Tue Jul 20 11:15:45 2015.bash_profile H 191 Tue Feb 10 14:24:53 2015.bashrc H 124 Tue Feb 10 14:24:53 2015 lab10 D 0 Wed Jul 21 09:04:13 2015 samba-3.0.12.tar.gz 5453486 Wed Jul 21 10:20:49 2015 60892 blocks of size 32768. 495 blocks available smb: \> pwd Current directory is \\JANKOVIC\goranj\ smb: \> qui...continued...

CTEC1863/2017F Lab #10 Samba Page 6 of 11 10...continued... The Linux client is similar to FTP, so you can transfer files. smb: \> help? altname archive blocksize cancel cd chmod chown del dir du exit get hardlink help history lcd link lowercase ls mask md mget mkdir more mput newer open print printmode prompt put pwd q queue quit rd recurse reget rename reput rm rmdir setmode symlink tar tarmode translate vuid logon! 11. Repeat procedures 9 and 10 on your Ubuntu VM. (You may need to install the Samba client first.) This uses Ubuntu as the client, connecting to your CentOS server over the network. (Samba can be used to transfer files between Linux and Linux, but the protocol is very inefficient! NFS [Lab 9] is better.) PART B: Test Samba using Microsoft Windows 12. From Windows, if you are logged in as Administrator, simply open a Command Prompt. If you are logged in as l17student, go to the Start menu, All Programs, Accessories. Right-click on Command Prompt and select Run as Adminstrator (and agree to the UAC prompt.) OR Boot another PC into the L17 Open Windows 7 partition and log on as Administrator. Verify that you are on the CIT network (as indicated by a 192.168.2 or 192.168.3 IP address.)...continued...

CTEC1863/2017F Lab #10 Samba Page 7 of 11 12....continued... Use ping to contact your CentOS VM (using your IP address from Part A, Step 9.) Note: for these examples, assume that user Srdjan Matovina has a Samba server called MATOVINA on IP address 172.31.40.2 and a Samba user name srdjan. 13. (a) Open the c:\windows\system32\drivers\etc\lmhosts.sam file using Notepad. The easiest way to do this is to cd into the directory first using the Tab key for assistance, and then run notepad lmhosts.sam from the Command Prompt (so that it is running as Administrator.) Add an entry for your Samba server (since we don't have a WINS server handy.) For example:...continued...

CTEC1863/2017F Lab #10 Samba Page 8 of 11 13...continued... Save the file as c:\windows\system32\drivers\etc\lmhosts -- NO EXTENSION! Verify using the Command Prompt that the file has no extension and rename it if necessary. (b) Do the same with the c:\windows\system32\drivers\etc\hosts file (since we don't have control of the DNS server either.) Test your hosts file entry by ping-ing the hostname(s).

CTEC1863/2017F Lab #10 Samba Page 9 of 11 14. From Windows Explorer window, enter the UNC name for your Samba server using your Samba username and password. For our example server, its UNC name is \\MATOVINA You can also enter the IP address instead in the UNC format, e.g., \\172.31.40.2 Windows may also show your Samba server in the left pane of the Explorer window, under Network.

CTEC1863/2017F Lab #10 Samba Page 10 of 11 15. Double-click on a share to view the contents of the share. Alternatively, you can right-click on a share and map a network drive to it. The UNC name for your home directory is in the form: \\ yourservername \yourusername For our example server, Srdjan's home directory, in UNC form, is: \\MATOVINA\srdjan...continued...

CTEC1863/2017F Lab #10 Samba Page 11 of 11 15....continued... OR you can use NET USE commands to manage the drive. 16. Try to read and write files to and from the share using Windows programs. When You Are Done 1. Take a screen shot of your Windows 7 PC connected to your Samba server, using the Snipping Tool. 2. Email the screen shot and your Linux smb.conf file [hint: you can copy it to Windows via one of your Samba shares first] to your professor. (Or post on BB.)