In this lab, you will create a mount entry in /etc/fstab and mount
it.
| Resources: | |
|---|---|
| Files: |
samba.txt in the server directory, for testing. |
| Machines: | desktopX and serverX |
Outcomes:
cifs-utils package installed.
The serverX student home folder mounted at
/home/student/work.
The /etc/fstab file includes the mount entry.
Reset your serverX system.
Log into and set up your server system.
[student@serverX ~]$lab samba setup
Reset your desktopX system.
Log into desktopX and open a terminal.
You have a home directory on serverX that is used to store work-related documents. The directory is shared via Samba to support all of the company desktop operating systems.
The serverX administrator has confirmed that the share name is student and
that the uid/gid are the same as your desktopX instance; the share password is
student.
Install the Package
Use yum to install cifs-utils.
[student@desktopX ~]$sudo yum -y install cifs-utilsLoaded plugins: langpacks Resolving Dependencies ... Complete!
This package provides support for mounting CIFS file systems and is used by the mount command.
Create the Mount Point
Use mkdir to create the work directory mount
point.
[student@desktopX ~]$mkdir ~/work
Create the Credentials File
Use mkdir to create the secure
directory.
[student@desktopX ~]$sudo mkdir /secure
Use vim to create the credentials file
student.smb and populate it.
[student@desktopX ~]$sudo vim /secure/student.smb
Add the following lines:
username=student password=student domain=MYGROUP
Use chmod to protect the secure directory
and the student.smb credentials file.
[student@desktopX ~]$sudo chmod 770 /secure[student@desktopX ~]$sudo chmod 600 /secure/student.smb
Update /etc/fstab and Mount
Use vim to add the mount settings to the end of
/etc/fstab.
[student@desktopX ~]$sudo vim /etc/fstab... //serverX/student /home/student/work cifs credentials=/secure/student.smb 0 0
Use mount to verify the settings and mount the file system.
[student@desktopX ~]$sudo mount -a
This command should report no errors. If it does, check your settings in
/etc/fstab.
Check Your Access
Use cat to output the samba.txt
file.
[student@desktopX ~]$cat ~/work/samba.txtSuccess
Use echo to write to the work mount
point.
[student@desktopX ~]$echo testing > ~/work/test.txt