Open main menu

CDOT Wiki β

Changes

OPS335: File Servers

2,931 bytes removed, 10:56, 6 March 2016
no edit summary
{{Admon/tip|Changing Existing Samba Account Passwords|If you need to change a user's existing Samba account password, you can issue the following command as root: '''smbpasswd username'''.}}
<ol><li value="6">Confirm the user you created has been added using the following command:<br>'''pdbedit -L -v'''</li><li>Test and review your configuration with the command:<br>'''testparm'''</li><li>Use the '''systemctl ''' command to start the smb.service and enable the service to run on boot-up</li><li>Modify the firewall on VM2 to allow samba traffic.</li><li>Test to see that you can connect to your Samba server (locally) by issuing the following command:<br>'''smbclient -U <yourSenecaID> -L 127.0.0.1'''</li><li>When prompted, enter your Samba account password.</li><li>The output from that issued command show appear similar to example displayed below:</li></ol>
Sharename Type Comment
==INVESTIGATION 2: CONNECTING TO A SAMBA SERVER FROM A WINDOWS CLIENT==
This investigation will configure your VM2 machine to act as a Samba File server to allow Windows OS Users access to its the Linux Samba server files.
=== Creating a Windows7 Professional VM ===
To demonstrate how to access and share files from a remote MS Windows server using '''smbclient''' on your '''host''' machine, we will install a Windows7 Professional machine as a virtual machine.
'''Perform the following steps:'''
#Make certain you are using your '''host''' machine.
#Download a version of MS Windows Windows7 Professional ISO file to your host machine. If you have already downloaded an ISO file, then you can use that (i.e. transfer to your host machine).<br>'''NOTE:''' You cannot use a CD/DVD since KVM does not install by CD/DVD.<br><br>'''ALTERNATIVE METHOD:''' You could also refer to the following link to download Windows7 OS image: https://inside.senecacollege.ca/its/software/ , <br>select '''Software Downloads''', login with your senecaid and password, select '''MSDN''', and then select a Windows7 Professional iso image to download.<br>You are <u>not</u> required to obtain a product key since you will not need to extend the use of this Windows OS over 60 days.
{{Admon/tip |Rearming the Windows Trial Version|If are your trial period for your Windows machine is nearly over, you can extend the trial period for another 30 days by running a command prompt as the <u>administrator</u> (right-click on '''cmd''' icon) and issuing the command: '''slmgr -rearm'''. Obviously, you are required to perform this operation prior to the termination of the initial trial period.}}
<ol><li vaLUE="3">Create a new virtual machine (RAM: '''1024 MB''', hard drive size: '''20 GB''', accept all other defaults) making certain to specify the location of your downloaded Windows OS iso file.</li><li>Install the Windows OS creating a default user as the administrator.</li><li>Upon successful installation, open log into the command prompt on your Windows machineas a regular user, open a command prompt and issue using the ''ipconfig'ping''' command to record its '''IPADDR'''confirm that you can connect to your VM2 machine.</li><li>x</li><li>x</li><li>x</li></ol>
===Accessing Files on a Linux Samba Server via Windows Explorer ===
'''Perform the following tasks:'''
# Make certain that both your VM2 and Windows virtual machines are running. #From the menu in the side-bar of the files tool, choose '''Connect to ServerVM2'''. #Enter and '''smb://vm2/homeWindows''' as the location, and enter your samba password in the promptvirtual machines are running.#Where vm2 is the name of the server, and home is the name of the directory it is sharing.#After you have checked that you can access On your filesWindows VM, unmount temporarily turn off the share by right-clicking its icon in the side-bar and clicking 'Unmount'. === Accessing MS Windows Files via a Graphical Web Browser (konqueror) === If firewall for your web browser application support the SMB protocol, you can also access files on your remote Windows server by a web browsermachine'''Perform the following tasks:'''#You can also use a web browser with support for Open the SMB protocol such as Konqueror. Note that firefox does not have such supportWindows Explorer application. #If Konqueror is not installed then install it with At the command:<br>'''yum install kdebase'''#Start Konqueror, top of the web/file browserapplication, and in the address bar enter the following:<br>'''smb://vm2/\\IPADDR_OF_VM2_MACHINE\home'''#Enter You will be prompted to enter your VM2 username and password when prompted.#Double click (refer to diagram on a file you have some text inright).#Open it with gedit, make some changes, and save it.#When prompted, choose to upload the file.Where your successful?#Close KonquerorWindows Explorer application window.#cat the file on Switch to your VM2 to ensure the changes were properly uploaded.  '''Record steps, commands, and your observations in INVESTIGATION 2 in your OPS335 lab log-book'''  ==UNDER CONSTRUCTION: TO BE REMOVED AND / OR ABSORBED == Although the main purpose of running a samba server is to share files on a Windows server, you can also install a Samba client on another Linux machine to share files as well. This lab will demonstrate how to setup a Samba client on your '''host''' machine, mount the samba share on a directory, and access files on the remote Linux machine ('''vm2''').  ==# Tweak config file browsable = Accessing and Sharing Files on Remote Linux Server (smbclient)===   '''Perform the following steps:'''yes#In a full installation (on your host Linux machine) you should not need Return to install the '''samba-client''' application on your host, but if it is not present, then install that Windows VM and open another Windows explorer application.window#You will also need to install Again, at the ''cifs-utils'' package to be able to mount top of the filesystem:<br>'''yum install cifs-utils'''#From application, enter the host use the "smbclient" command in a terminal windowfollowing:<br>'''smbclient '\\vm2IPADDR_OF_VM2_MACHINE\home' -U <learnid>'''#After entering your password you should get a prompt similar to:<br>'''smb: \>'''What happens this time?#Enter the ls command to see a list of the files in In your home directory:<br>'''smb: \> ls'''<br><br>'''NOTE:''' you may receive the following error: ''NT_STATUS_ACCESS_DENIED listing''<br><br>#SE Linux should be in Enforcing and will need to be adjusted (on the samba server) for this to work by issuing the command:<br>'''setsebool -P samba_enable_home_dirs 1'''#Once you have access to the directory use the '''get''' and '''put''' commands (similar to sftp) to move files.#When you are finished close the connection. === Mounting a Remote Linux Volume (mount -t cifs) === When performing the NFS labWindows machine, one of modify the initial purpose of using NFS was allowing network shares firewall setting to mount remote volumes as opposed to using '''sftp''' (''get'' and ''put'' commands). This section will demonstrate how to '''mount a remote Linux volume''' as a directory make appropriate exceptions for the client Linux server. '''Perform the following steps:''' #Issue the following command to create a mount point called vm2-home:<br>'''mkdir /tmp/vm2-home'''#Issue the following command in order to mount your home directory:<br>'''mount -t cifs //vm2/home /tmp/vm2-home -o username=<learnid>'''#Verify that the mount worked by issuing the following command:<br>'''ls /tmp/vm2-home'''#What is the advantage of using this method as opposed to the smbclient command in the previous section? Record your answer in your lab log-bookVM2 machine
'''Record steps, commands, and your observations in INVESTIGATION 2 in your OPS335 lab log-book'''
13,420
edits