How to edit /etc/fstab properly for network drive?
Each line in the
/etc/fstab file contains the following fields separated by spaces or tabs:
file_system dir type options dump pass
A typical mount point added in /etc/fstab would look like the following:
# <file system> <dir> <type> <options> <dump> <pass> /dev/sda1 / ext4 defaults,noatime 0 1
You can't simply add a mount statement in the file.
Add this line to the end of your
//192.168.0.67/test /home/pi/test cifs username=myname,password=123,iocharset=utf8,sec=ntlm 0 0
After the /etc/fstab is edited you can test by mounting the filesystem with
mount -a which will check fstab and attempt to mount everything that is present.
In addition to 에이바's answer, you may want to place the credentials in a specific file called
.smbcredentials in your home directory for a little more security. This is a good practice especially for multiuser systems. This way you will be protecting your cifs password. Create a file:
/home/myname/.smbcredentials and include just two lines:
Set your permissions:
$ chmod 600 .smbcredentials
/etc/fstab include the following line:
//192.168.0.67/test /home/pi/test cifs credentials=/home/myname/.smbcredentials,iocharset=utf8,sec=ntlm 0 0
Be sure to test with a reboot.