Advertisement
Guest User

Untitled

a guest
Aug 27th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. `/etc/network/interfaces`
  2. ```
  3. # This file describes the network interfaces available on your system
  4. # and how to activate them. For more information, see interfaces(5).
  5.  
  6. source /etc/network/interfaces.d/*
  7.  
  8. # The loopback network interface
  9. auto lo
  10. iface lo inet loopback
  11.  
  12. # The primary network interface
  13. allow-hotplug eth0
  14. iface eth0 inet dhcp
  15. post-up /etc/network/if-up.d/cifs-mount
  16.  
  17. ```
  18.  
  19. `/etc/network/if-up.d/cifs-mount`
  20. ```
  21. #! /bin/sh
  22. # Remount network dependant CIFS mounts when the eth0 interface comes up.
  23.  
  24. set -e
  25.  
  26. cat /etc/fstab | grep cifs | sed 's/\,\?noauto\,\?//' >/tmp/cifs-fstab
  27. cat /tmp/cifs-fstab
  28. mount -a --fstab /tmp/cifs-fstab
  29. rm /tmp/cifs-fstab
  30.  
  31. exit 0
  32.  
  33. ```
  34.  
  35. `/etc/fstab`
  36. ```
  37. # /etc/fstab: static file system information.
  38. #
  39. # Use 'blkid' to print the universally unique identifier for a
  40. # device; this may be used with UUID= as a more robust way to name devices
  41. # that works even if disks are added and removed. See fstab(5).
  42. #
  43. # <file system> <mount point> <type> <options> <dump> <pass>
  44. /dev/sda1 / ext4 errors=remount-ro 0 1
  45. /dev/sda5 none swap sw 0 0
  46. /dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
  47. //192.168.0.1/share /mnt/share cifs noauto,credentials=/home/user/.smbcredentials,iocharset=utf8,sec=ntlm,file_mode=0777,dir_mode=0666,noperm 0 0
  48.  
  49. ```
  50.  
  51. `/home/user/.smbcredentials`
  52. ```
  53. username=WindowsUser
  54. password=########
  55.  
  56. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement