banner



How To Mount Windows Share In Linux

mount windows share on ubuntu linux

CIFS (Common Internet File System) is a popular file sharing protocol on Internet. It allows users on a Linux system access to a detail mount point on a windows share.

CIFS is an implementation of SMB (Server Bulletin Block) - a protocol used for network file sharing.

This tutorial will go through all steps of installing and configuring relevant utilities in order to mount windows share on Linux system.

Installing CIFS

Install cifs-utils package on Ubuntu Linux by using the following command line

          $ sudo apt-get update $ sudo apt-go install cifs-utils        

Mounting a Windows Share

In this section, the tutorial will show yous the way to manually and automatically mount windows share on Linux systems.

Creating a directory on your Ubuntu Linux machine, the name of directory is arbitrary. In the below command line, I created a binder named winshare under /mnt

          $ sudo mkdir /mnt/winshare        

/mnt/winshare is the mountain signal of the remote windows share.

Windows share can be mounted on your Ubuntu Linux system mount bespeak using cifs option of mountain command

          $ sudo mountain -t cifs -o username=$windows_user,password=$windows_user_password //WIN_SHARE_IP/$shared_name /mnt/winshare        

Where:

WIN_SHARE_IP is the IP address of windows machine.

If the $windows_user is in a windows domain, specify the domain as the following control line

          $ sudo mount -t cifs -o username=$windows_user,password=$windows_user_password,domain=$windows_domain_name //WIN_SHARE_IP/$shared_name /mnt/winshare        

By default, linux mount windows share with the full permission (rwx or 777). If you desire to change the permission on your own, delight use the dir_mode and file_mode options to set permission for directory and file.

          $ sudo mountain -t cifs -o username=$windows_user,password=$windows_user_password,dir_mode=0755,file_mode=0755 //WIN_SHARE_IP/$shared_name /mnt/winshare        

You also tin can change the default ownership of user and grouping by specify the uid (user id) and gid (group id) options.

          $ sudo mountain -t cifs -o username=$windows_user,password=$windows_user_password,uid=m,gid=1000,dir_mode=0755,file_mode=0755 //WIN_SHARE_IP/$shared_name /mnt/winshare        

Once the windows share is successfully mounted, using control df -h for verifying the mounting windows share in Linux. In the following example, WIN_SHARE_IP = 192.168.1.8 and $shared_name = sharefolder

          $ df -h Filesystem                 Size  Used Avail Apply% Mounted on udev                       3,9G     0  iii,9G   0% /dev tmpfs                      787M  2,2M  785M   1% /run /dev/sda2                  450G   23G  405G   6% / tmpfs                      3,9G  705M  three,2G  xviii% /dev/shm tmpfs                      5,0M  4,0K  v,0M   i% /run/lock tmpfs                      three,9G     0  3,9G   0% /sys/fs/cgroup //192.168.1.8/sharefolder  300G  five,7G  295G   2% /mnt/winshare        

Secure CIFS credential

This department will explain how to utilize a credential file when your Ubuntu Linux mountain the share using control.

Create a cifs credentials file: /etc/cifs-credentials. The file contains the below information:

          username = $windows_user password = $windows_user_password domain = $windows_domain_name        

Grant permission read and write to credentials file:

          $ sudo chmod +rw /etc/cifs-credentials        

At present, we can mount the share using credentials with control as follows:

          $ sudo mount -t cifs -o credentials=/etc/cifs-credentials //WIN_SHARE_IP/$shared_name /mnt/winshare        

Auto mount the shares

If y'all manually mountain the shares using mount command, when y'all reboot your Linux machine, the shares will exist lost.

The file /etc/fstab contains the necessary configuration that allows automatically mount cifs permanently.

Edit the /etc/fstab file with your favorite editors (vim, nano,...)

          $ sudo vim /etc/fstab        

Then add the post-obit line to the file.

          //WIN_SHARE_IP/$shared_name /mnt/winshare cifs credentials=/etc/cifs-credentials,file_mode=0755,dir_node=0755 0 0        

Run the command to mountain all the entries listed in /etc/fstab

          $ sudo mount -a        

Since so, the mountain cifs will be persistent across reboots.

Unmount the shares

In guild to unmount a share, you have to determine the mount point. In the higher up example, mountain point is /mnt/winshare. Employ the umount command:

          $ sudo umount /mnt/winshare        

If the mount point is in a busy process and the higher up control failed, run command with option -l (--lazy)

          $ sudo umount -t cifs -fifty /mnt/winshare        

Conclusion

The tutorial has gone through all steps to mount a windows share on Ubuntu Linux using CIFS. If you have any questions, feel costless to reach out to u.s..

Source: https://linoxide.com/mount-windows-share-on-ubuntu-linux/

Posted by: thomasglat1937.blogspot.com

0 Response to "How To Mount Windows Share In Linux"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel