01 July 2020

auto mount smb folder on boot

1- manual mount:

sudo mount -t cifs -o username=pakAbu,password=takselamat //1.1.1.1/sharefolder  /mnt/mount_disini/



2- mount on boot

/etc/fstab:

//1.1.1.1/sharefolder /mnt/mount_disini cifs username=pakAbu,password=takselamat 0 0



3- use third file to store credential

/etc/mywinlogin.txt:
username=pakAbu
password=takselamat
domain=WORKGROUP

/etc/fstab:
//1.1.1.1/sharefolder /mnt/mount_disini cifs credential=/etc/mywinlogin.txt 0 0


This will make folder /mnt/mount_disini own by user root, and group root.


4- to change mount dir to normal user
//1.1.1.1/sharefolder /mnt/mount_disini cifs credential=/etc/mywinlogin.txt,uid=1001,guid=1001 0 0

Notice parameter uid and gid. uid number refer to /etc/passwd. gid refer to /etc/group


No comments:

Post a Comment

Terima kasih