Linux – mounting network share

How to add samba share to your file system? And how to make this change persistent so the share is mounted automatically at boot time?

Manually you can mount it using mount command into for instance ~/Video, like

sudo mount -t cifs -o user=John,password=JohnsP@ssw0rd,rw,hard,nosetuids,noperm,sec=ntlm // ~/Video

The command above mounts network share drive Video on IP to user’s home directory ~/Video using logon credentials (to access the share drive) name=John, password=P@ssw0rd

To keep this mount persistent, you have to edit /etc/fstab and add an entry like this

// /home/LOCAL_USER/Video cifs auto,user,rw,uid=LOCAL_USER,gid=LOCAL_GROUP,workgroup=WORKGROUP,iocharset=utf8,credentials=/home/LOCAL_USER/.secret/smb 0 0

And in /home/USER/.secret/smb you have to put the logon credentials


Leave a Reply