Mounting CIFS Shares At the LINUX Command Line or in /etc/fstab


Linux makes it relatively easy to mount shared drives either manually, at the command line, or automatically, by configuring an entry in /etc/fstab. Here is the basic syntax of our mount command.

[ccase@midas ~]$ sudo mount -t cifs  -o username=,password=, /// 

Here is an example of mounting our CIFS share to a folder named myshare. We are using the option ro to mount the share read only.

[ccase@midas ~]$ sudo mount -t cifs  -o username=admin,password=secret,ro //192.168.1.200/myshare myshare

If we want to make this automatic, it can easily be configured in /etc/fstab/ to mount after the network comes up. Here is the basic syntax you would use in /etc/fstab/

///  cifs  username=,password=,_netdev,   0 0

Here is an example of mounting our CIFS share automatically to /mnt/myshare/. We are using the option _netdev, to tell it to attempt the mount only after the network has come up and ro, to mount the share read only.

//192.168.1.200/myshare /mnt/myshare cifs  username=admin,password=secret,_netdev,ro   0 0

Leave a Reply

Your email address will not be published. Required fields are marked *