Little Known Ways to Mount Windows Share On Linux RHEL 8
Little Known Ways to Mount Windows Share On Linux RHEL 8 |
Little Known Ways to Mount Windows Share On Linux RHEL 8 - Welcome back to kitsake.com blog. On this occasion, I will share a trick for mounting file sharing located on a Windows server and integrating it into the RHEL 8 Linux OS system.
A little story behind why I created Mount Windows Share On Linux is because there is an application running on the RHEL 8 OS that generates many files, and these files are also needed by a host using the Windows Operating System.
Mount Windows Share On Linux |
Several Methods for File Transfer.
Actually, there are many ways to send those files, starting from using commands or methods like the ones below:
- FTP stands for File Transfer Protocol. It is a standard network protocol used to transfer files from one host to another over a TCP-based network, such as the internet. FTP is commonly used for sharing files between a client and a server. The client initiates a connection to the server to upload or download files, navigate directories, and perform other file-related operations.
- SFTP stands for Secure File Transfer Protocol. It is a secure extension of the File Transfer Protocol (FTP), designed to provide secure file transfer capabilities. Unlike traditional FTP, which is not inherently secure, SFTP encrypts both the data and the commands exchanged between the client and server, adding a layer of security to the file transfer process.
- LFTP, short for "LFTP Command-Line File Transfer Program," is a sophisticated and powerful file transfer client for Unix-like operating systems, including Linux and macOS. It supports a variety of protocols for file transfer, including FTP, FTPS (FTP Secure), HTTP, HTTPS, FISH (Files transferred over Shell protocol), and SFTP (Secure File Transfer Protocol).
The above methods can be applied to send files, and the key is that the files can be successfully located on the Windows server host, regardless of the method you use.
Mount Windows Share On Linux
Now, in this article, I will share another method for sending files, namely by using the method of mounting a shared folder in Windows and displaying it in the Linux file system. This way, it will be easier to manage because the application logic has two options:
- The generated files are directly directed to the path, where the path is the shared folder located in Windows and already mounted in Linux.
- Alternatively, the generated files can be copied using the 'cp' command from the source path of generation to the mounted path.
Everything depends on you as a system administrator; different people have different logics. Find the most effective approach for the system, and this is one method that I can share with you.
How to Make Folder Share on Windows
Step 1: Create a Folder on Drive D:
# Open Windows Explorer and select drive D: - Right-click - New - New Folder.
Step 2: Share these folders
# Right-click on the folder to be shared - Properties - click the Sharing tab - click Share
# On the next tab, scroll down and select everyone - set the permission level to Read/Write - Click Share
# Klik Done - Close
How to Mount CIFS Share
Okay, after a lot of prologue that I've mentioned above, let's get straight to the material. Follow the steps below.
Step 1: Install CIFS Utilities Packages on Linux
First, update the system repository:
# yum update
Next, install the CIFS-Utils package by running the following command:
# yum install cifs-utils
Step 2: Create a Directory to Mount Windows Share
# mkdir -p /opt/kitsake
Step 3: Mount a CIFS Windows Share
# mount -t cifs //[IP_Address]/[share_name] /opt/kitsake -o username=[username]
Before you add a file system, you can check the status of the file system so that you can feel the difference before and after the changes are made, using the method below;
# df -h
If you encounter issues when mounting normally as mentioned above, with an error output like the one below;
mount error(112): Host is down Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Host is down |
To overcome the above issue, you simply need to add the version option to the mounting command like this;
# mount.cifs //[IP_Address]/[share_name] /opt/kitsake -o username=[username],vers=3.0
Step 4: Make the Windows Share Automatically Mount at Boot
Create a file to store the username and password for the Windows server.
# vi /etc/cifs-credentials
username=[username] password=[password]
Edit the fstab file and input the following command;
# vi /etc/fstab
//[IP_Address]/[share_name] /opt/kitsake cifs credentials=/etc/cifs-credentials 0 0
If you encounter a 'host is down' issue during manual mounting, you also need to modify the file in fstab by including the version option in it for a successful mount.
//[IP_Address]/[share_name] /opt/kitsake cifs vers=3.0,credentials=/etc/cifs-credentials 0 0
After finishing creating the fstab, you can use the command 'mount -a' to ensure that everything is running perfectly.
# mount -a
Then, you can also confirm by checking the filesystem using the command 'df -h'.
# df -h
check disk linux after mounting folder shared windows |
How to Unmount CIFS Windows Share
# umount /opt/kitsake
Make sure you also remove the command that has been added to fstab to prevent it from remounting when the system is rebooted.
Conclusion
Those are some reasons and solutions to the existing problems, using the method of Mount Windows Share On Linux will facilitate the file transfer from one host to another. Don't forget to always back up first before you do anything, especially if what you're doing is within a production environment.
Post a Comment for "Little Known Ways to Mount Windows Share On Linux RHEL 8"
Post a Comment