How to mount smb/cifs shares under linux

This document provides help on mounting SMB/CIFS shares under Linux.
All files accessible in a Linux and UNIX systems are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree.

Use the mount command to mount remote SMB/CIFS shares under Linux as follows:

1 [[email protected]~]#mount -t cifs // -o username=myUser,password=myPassword /mnt/mySharedFolder

-t cifs : File system type to be mount
-o : are options passed to mount command, in this example I had passed two options. First argument is the user name (myUser) and second argument is the password (myPassword) to connect to the remote computer.
// : remote computer and share name
/mnt/mySharedFolder : local mount point directory

Make sure to create /mnt/mySharedFolder first.

Once this happens you can change to the directory and view the contents using cd and ls command:

1 [[email protected]~]#cd /mnt/mySharedFolder
2 [[email protected]~]#ls -la

To mount a SMB/CIFS share to be mounted when a Linux system comes up after reboot edit the /etc/fstab file and an entry as follows:

// /mnt/mySharedFolder cifs username=myUser,password=myPassword 0 0

Replace //, myUser and myPassword with your actual parameters.