Advertisement
Guest User

Untitled

a guest
Mar 14th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. Server installation
  2. Install "samba" for the server
  3.  
  4. Copy default configuration in /etc/samba/
  5.  
  6. Configuration:
  7. Set "workgroup" to "WORKGROUP", that being the default for Windows
  8.  
  9. Maybe set a nice "server string"?
  10.  
  11. Set "hosts allow" to "192.168.0.", networks are space separated. Note that the host part of the address is simply excluded, to indicate the size of the network.
  12.  
  13. To disable printers, set the following:
  14. load printers = no
  15. printing = bsd
  16. printcap name = /dev/null
  17. disable spoolss = yes
  18. ..then comment out the [printers] section.
  19.  
  20. Set "interfaces" to names/addresses of the interfaces samba should use. Default/setting it to nothing makes it use all interfaces.
  21.  
  22. Set "deadtime" to something reasonable like "60" minutes. This kills inactive connections after that time.
  23.  
  24. Setting "max connections" to "100" or something might be good too.
  25.  
  26. Disable netbios completely with "disable netbios = yes".
  27.  
  28. Set some default permissions with the following options:
  29. create mask = 0744
  30. direcroty mask = 0755
  31. force create mode = 0000
  32. force directory mode = 0000
  33. The first two are the "maximum" permissions for new files and directories, and the "force.." two are for the "minimum" permissions. They are, respectively, ANDed and ORed with the mode of what the client is trying to create.
  34.  
  35. Make samba not store the "archive bit" from windows clients in the execute bit of files by setting "map archive = no".
  36.  
  37. Create the relevant share definitions
  38.  
  39. Validate configuration with "testparm -s"
  40.  
  41. Create user(s) with "pdbedit -a -u <name>". -a is for "add user" and -u <name> is to specify a name.
  42.  
  43. Start and enable "smbd.service", not "nsmbd.service" unless we want netbios.
  44.  
  45. Make sure ports are forwarded. Only "445" seems to be required if not using netbios.
  46.  
  47. Client installation
  48. Install cifs-utils or smbclient, the later poviding share listing tools and stuch fun things, and is a dependency of programs like mpd and mplayer.
  49.  
  50. Create a directory to mount the shares, for example /media/samba/[share name]
  51.  
  52. Create files to store credentials, for example in /etc/samba/credentials/[share name]
  53. Set the file's permission so only root can read it: chmod 600 [filename]
  54. The format of the file is:
  55. username=[username]
  56. password=[password]
  57. domain=[domain/workgroup]
  58.  
  59. Do a test mount with:
  60. mount -t cifs //[server]/[share name] /media/samba/[share name] -o credentials=/etc/samba/credentials/[share name]
  61. Optionally add gid= and uid= options to remap user and group id to some local one.
  62.  
  63. Add fstab entries for the mounts:
  64. //[server]/[share name] /media/samba/[share name] cifs credentials=/etc/samba/credentials/[share name],noauto,x-systemd.automount,x-systemd.device-timeout=30 0 0
  65. Optionally add gid= and uid= options to remap user and group id to some local one.
  66.  
  67. Check so the fstab entries work:
  68. 1. Unmount the test mount
  69. 2. Reload systemd units: systemctl daemon-reload
  70. 3. Restart the remote filesystem target: systemctl restart remote-fs.target
  71. Cding into the mountpint of the shares should mount them now
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement