Post

Automatically mount SMB / CIFS / Windows share on Debian at startup

As root user, create a credentials file.
Note that and should be entered without “<>” brackets.

1
2
3
root@Erebus:~# cat > .smbcredentials  
username=<user>  
password=<password>

Add a line to your /etc/fstab:
Specify the local machine username which you will access the share as

1
//<server-IP>/<server-share> <local-mount-point> cifs uid=<local-username>,credentials=/root/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

In my case it looks like this:

1
//192.168.2.200/DATA /media/BIGBOX1 cifs uid=jonas,credentials=/root/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

If things don’t work, try mounting the share manually first. Also, ensure that cifs-utils is installed.

This post is licensed under CC BY 4.0 by the author.