This guide shows how to mount a Windows share (SMB) on RHEL / CentOS 8 Linux.
I’ll show you two manners. The first is temporary mount, and the other is automatic and persistent.
Preparation
Install cifs-utils.
yum install cifs-utils
Temporary mount
This is the way to mount temporarily. If you follow this procedures, a mounted folder is unmounted after OS reboot.
(1) Create a mount point directory.
mkdir /mnt/nas
(2) To mount a Windows shared folder, run the following command.
Note: Assume that a network path of Windows shared folder is //192.168.1.1/share
mount -t cifs -o user=[User Name],password=[Password] //192.168.1.1/share /mnt/nas
To unmount a mounted folder, run the following command.
umount /mnt/nas
The procedures for temporary mount is completed.
If you follow that, a mounted folder is unmounted after OS reboot.
The following is for automatic and persistent mount.
Automatic and persistent mount
The following guide shows the procedure for automatic and persistent mount.
(1) Create a mount point directory.
mkdir /mnt/nas
(2) Edit fstab.
vi /etc/fstab
Add the following to the last line of the fstab.
Note: Assume that a network path of Windows shared folder is //192.168.1.1/share
//192.168.1.1/share /mnt/nas cifs user=[User Name],password=[Password],defaults 0 0
(3) Refrect the fstab.
mount -a
That’s about it.
网友评论