Advertisement
shokti

ubuntu server - samba installation

Oct 10th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. install samba:
  2. sudo apt-get install samba samba-common
  3.  
  4. create directory to share:
  5. sudo mkdir /srv/share
  6. sudo chown nobody:nogroup /srv/share
  7. sudo chmod 777 /srv/share
  8.  
  9. sudo mkdir /srv/public
  10. sudo chown nobody:nogroup /srv/public
  11. sudo chmod 777 /srv/public
  12.  
  13. create new user and assigned to group users:
  14. sudo useradd linuxuser1 -m -G users
  15.  
  16. set unix password:
  17. sudo passwd linuxuser1
  18.  
  19. set samba user password:
  20. sudo smbpasswd -a linuxuser1
  21.  
  22.  
  23. edit samba config file /etc/samba/smb.conf:
  24. sudo vi /etc/samba/smb.conf
  25.  
  26. [global] security = USER
  27.  
  28. [homes]
  29. comment = Home Directories
  30. browseable = no
  31. valid users = %S
  32. writable = yes
  33. create mask = 0755
  34. directory mask = 0755
  35.  
  36. [shared]
  37. comment = shared folder for all users group
  38. path = /srv/share
  39. browseable = yes
  40. writable = yes
  41. create mask = 0755
  42. directory mask = 0755
  43. valid users = @users
  44.  
  45. [public]
  46. comment = public folder available to anyone without authentication but readonly
  47. path = /public/public
  48. browseable = yes
  49. guest ok = yes
  50. read only = yes
  51.  
  52. restart service:
  53. sudo service smbd restart
  54. sudo service nmbd restart
  55.  
  56. --------------------------------------------------------------------------------------------------------------------
  57.  
  58. read only: This parameter controls whether an user has the ability to create or modify files within a share. This is default.
  59.  
  60. guest ok: Uf this parameter is set to yes, the users will have access to the share without having to enter a password. This can pose security risk.
  61.  
  62. writeable: Specifies users should have write access to the share.
  63.  
  64. read list: This option accepts a list of usernames or a group as its value. Users will be given read-only access to the share.
  65.  
  66. valid users: You can make a share available to specific users. Usernames or group names can be passed on as its value.
  67.  
  68. invalid users: Users or groups listed will be denied access to this share.
  69.  
  70. write list: create a list of users to give write access to the share.
  71.  
  72. create mask: This option is set using an octal value when setting permissions for files.
  73.  
  74. directory mask: Directories must have the execute bit for proper access. Default parameter is 0755.
  75.  
  76. available: specifies that the file share is available to clients on the network.
  77.  
  78. --------------------------------------------------------------------------------------------------------------------
  79. NOTE: if your samba server has a firewall then add the iptables rules below:
  80.  
  81. #allow samba share
  82. /sbin/iptables -A INPUT -p udp -m udp -s 192.168.0.0/24 --dport 137 -j ACCEPT
  83. /sbin/iptables -A INPUT -p udp -m udp -s 192.168.0.0/24 --dport 138 -j ACCEPT
  84. /sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp -s 192.168.0.0/24 --dport 139 -j ACCEPT
  85. /sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp -s 192.168.0.0/24 --dport 445 -j ACCEPT
  86.  
  87. NOTE: if your samba server is a NAT server then edit /etc/samba/smb.conf:
  88.  
  89. interfaces = 192.168.0.0/24 127.0.0.0/8 eth1
  90.  
  91. bind interfaces only = yes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement