HostOnNet Blog

Mounting Windows File System on Linux

To mount a windows file system (CIFS/Samba) on Linux, run

mount -t cifs -o username=USER-NAME-HERE,password=PASSWORD-HERE //SERVER-IP-HERE/SHARE-NAME /mnt

Example

mount -t cifs -o username=hostonnet,password=lt0JX7kIcXjqQquj //176.9.162.170/backup /mnt

To auto mount file system on boot, add following to /etc/fstab

//176.9.162.170/backup /backup cifs  username=hostonnet,password=lt0JX7kIcXjqQquj  0  0

Now run

mount -a

You will see the network drive mounted

[root@ssd ~]# df -h | grep backup
//176.9.162.170/backup  500G  7.3G  493G   2% /backup
[root@ssd ~]# 

Common Errors

failed: Key has expired error is due to wrong password or username. Verify your login credentials are correct.

root@backup:~# mount -t cifs -o username=hostonnet,password=superman123 //176.9.162.170/backup /mnt
mount: mount //176.9.162.170/backup on /mnt failed: Key has expired
root@backup:~#

Posted in Linux