Mount Windows Shared Folders
Provides a tutorial example on how to mount Windows shared folders on Linux systems. 'cifs-utils' device driver is needed.
If you have a Windows computer on the local network, you can share a folder with your Linux computer.
Here is what I did to share a folder on my Windows 10 with my CentOS 8 computer.
1. On my Windows 10 computer, create share folder and make it available for sharing:
- Go to "Control Panel > Network and Internet > Network and Sharing Center > Change advanced sharing settings",
select "Turn on file and printer sharing", and lick "Save changes" to turn on the
CIFS (Common Internet File System) service.
- Create the share folder C:\share.
- Open the Properties dialog box on C:\share, select "Share" tab,
and click "Share" button to open the Network Access dialog box.
- Entert "Everyone" and click "Add" to grant access permission for every user on this Windows 10 computer.
- Change the permission level to Read/Write and click "Share" button
to save changes.
2. On my CentOS 8 computer, install cifs-utils device drive and mount the shared folder.
Note that "192.168.1.7" is the IP address of my Windows 10 computer.
"herong" is the username on Windows 10 computer.
herong$ sudo dnf install cifs-utils
herong$ sudo mkdir /mnt/share
herong$ sudo mount -t cifs -o username=herong //192.168.1.7/share /mnt/share
Password for herong@//192.168.1.7/share: ********
3. Verify the shared folder. It works as expected!
herong$ sudo touch /mnt/share/junk
herong$ sudo ls -l /mnt/share/junk
-rwxr-xr-x. 1 root root 0 Oct 10 22:31 /mnt/share/junk
4. To mount it under a private user and group, you need to specify additional options
on the "mount" command.
For example, the following command mounts the shared folder for me to access only:
herong$ sudo mount -t cifs \
-o username=herong,uid=herong,gid=herong,dir_mode=0700,file_mode=0700 \
herong$ ls -l /mnt
drwx------. 2 herong herong 0 Oct 10 22:49 share
Cool. This is perfect for me to transfer files between my Windows 10 and CentOS 8 computer!
For more information on "cifs-utils" device driver, run "man mount.cifs" command
to read its man page.
Table of Contents
About This Book
Introduction to Linux Systems
Cockpit - Web Portal for Administrator
Files and Directories
Users and Groups
"df" - Display Free Space of File System
Mount USB Drive as File System
"fdisk" - Format Disk Partitions
"dd" - Copy Data from/to Storage Devices
Use "dd" Command to Test I/O Speed
"hdparm" - Hard Disk Parameters
"du" - Display Disk Usage of Directories
Mount Windows NTFS File System
Access Persmissions on "ntfs-3g" File System
►Mount Windows Shared Folders
W95 Ext'd (LBA) Partition
File System Types, IDs and Formats
LVM (Logical Volume Manager)
"parted" - Partition Manipulation Program
Reformat NTFS Partition into EXT4 Partition
Unreachable Remote File Systems
SELinux - Security-Enhanced Linux
Network Connection on CentOS
Software Package Manager on CentOS - DNF and YUM
Running Apache Web Server (httpd) on Linux Systems
Running PHP Scripts on Linux Systems
Running MySQL Database Server on Linux Systems
Running Python Scripts on Linux Systems
vsftpd - Very Secure FTP Daemon
Postfix - Mail Transport Agent (MTA)
Dovecot - IMAP and POP3 Server
Email Client Tools - Mail User Agents (MUA)
GCC - C/C++ Compiler
Conda - Environment and Package Manager
Tools and Utilities
Full Version in PDF/EPUB