Advertisement
Guest User

Untitled

a guest
May 1st, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.79 KB | None | 0 0
  1. Samba is a client/server system that implements network resource sharing for Linux and other UNIX computers. With Samba, UNIX files and printers can be shared with Windows clients and vice versa. Samba supports the Session Message Block (SMB) protocol. Nearly all Windows computers include SMB support with their internal network subsystems (NetBIOS in particular).
  2. With an appropriately-configured Samba server on Linux, Windows clients can map drives to the Linux filesystems. Likewise, the Samba client on UNIX can connect to Windows shares by their UNC name. Although differences among various operating systems (such as filesystem naming conventions, end-of-line conventions, and authentication) can limit interoperability, Samba offers a generally serviceable mechanism for resource sharing on a heterogenous network.
  3.  
  4. To install the samba package,enter the following command:
  5.  
  6. # yum install samba samba-client samba-common
  7. Check the version of installed samba software by using this command:
  8.  
  9. # smbd --version
  10.  
  11. https://imgur.com/iQrXP9g
  12.  
  13. Check Samba version
  14.  
  15. Configure the samba service, so that, it will start automatically at boot time:
  16.  
  17. # chkconfig smb on
  18. # chkconfig nmb on
  19. Add these Iptables rules, so that samba will work perfectly:
  20.  
  21. # iptables -I INPUT 4 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
  22. # iptables -I INPUT 5 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
  23. # iptables -I INPUT 6 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
  24. # service iptables save
  25. Backup the smb.conf file, then delete it and create the new one:
  26.  
  27. # cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
  28. # rm /etc/samba/smb.conf
  29. # touch /etc/samba/smb.conf
  30. # nano /etc/samba/smb.conf
  31. Add these lines, in your smb.conf file (or change it according to your requirement):
  32.  
  33. #======================= Global Settings =====================================
  34. [global]
  35. workgroup = WORKGROUP
  36. security = share
  37. map to guest = bad user
  38. #============================ Share Definitions ==============================
  39. [MyShare]
  40. path = /home/samba/share
  41. browsable =yes
  42. writable = yes
  43. guest ok = yes
  44. read only = no
  45. Save the smb.conf file and restart the service:
  46.  
  47. # service smb restart
  48. # service nmb restart
  49. Change permission for samba share:
  50.  
  51. # chmod -R 0777 /home/samba/share
  52. Access the samba share from windows (where 192.168.1.15 ip address of my samba server):
  53.  
  54. https://imgur.com/uUrjxoN
  55.  
  56. https://imgur.com/0cjHCyK
  57.  
  58. Access to Samba share
  59.  
  60. https://imgur.com/yNBIRKx
  61.  
  62. Successfully access to Samba share
  63.  
  64. Add and manage Samba users and groups
  65.  
  66. Add a group in your CentOS server:
  67.  
  68. # useradd smbuser
  69. # groupadd smbgrp
  70. # usermod -a -G smbgrp smbuser
  71. # smbpasswd -a smbuser
  72. Create a new share, set the permission on the share:
  73.  
  74. # cd /home/samba/
  75. # mkdir secure
  76. # chown -R smbuser:smbgrp secure/
  77. # chmod -R 0770 secure/
  78. Edit the smb.conf file:
  79.  
  80. # vi /etc/samba/smb.conf
  81. Add the newly created samba share in smb.conf file:
  82.  
  83. [Secure]
  84. path = /home/samba/secure
  85. valid users = @smbgrp
  86. guest ok = no
  87. writable = yes
  88. browsable = yes
  89.  
  90. https://imgur.com/mvNhcsd
  91.  
  92. Create new samba share
  93.  
  94. Restart the samba service:
  95.  
  96. # service smb restart
  97. # service nmb restart
  98. Check the syntax error with testparm:
  99.  
  100. # testparm
  101. Testing from Windows Machine:
  102.  
  103. https://imgur.com/4nAyoMv
  104.  
  105. Below is used to install the samba server
  106.  
  107. For Linux server without a GUI configured with Samba and Apache
  108.  
  109. -Create a group for developers populated with a few users.
  110.  
  111. user@Ubuntu1004:~$ pwd
  112.  
  113. /home/user
  114.  
  115. user@Ubuntu1004:~$ groupadd –f developers (Adds Group)
  116.  
  117. user@Ubuntu1004:~$ id nbe1
  118.  
  119. user@Ubuntu1004:~$ id nbe2
  120.  
  121. user@Ubuntu1004:~$ id nbe3
  122.  
  123. uid=1001(nbe1) gid=1001(nbe1)
  124.  
  125. groups=1001(nbe1), 502(developers)
  126.  
  127. context=root:system_r:unconfined_t:SystemLow-SystemHigh
  128.  
  129. user@Ubuntu1004:~$ useradd –D –G developers nbe1 (Adds User)
  130.  
  131. user@Ubuntu1004:~$ useradd –D –G developers nbe2 (Adds Another User)
  132.  
  133. user@Ubuntu1004:~$ useradd –D –G developers nbe3 (Adds Another)
  134.  
  135. -Share the default web path for Apache using Samba.
  136.  
  137. Firstly mount Samba Share in the Apache Directory. Where Apache’s httpd.conf file under your VirtualHost section is there, then update DocumentRoot to the directory where you have actually mounted that.
  138.  
  139. user@Ubuntu1004:~$ gedit /etc/httpd/conf/httpd.conf
  140.  
  141. -Allow the developers group to write to the share, give read access to others.
  142.  
  143. sudo usermod -a -G developers nbe1
  144.  
  145. sudo chgrp -R developers /var/www
  146.  
  147. sudo chmod -R g+w /var/www
  148.  
  149. sudo chgrp -R defualt /var/www
  150.  
  151. For Windows client
  152.  
  153. -Mapped network drive to the share on Linux server.
  154.  
  155. Open Windows adventurer by choosing the beginning so laptop.
  156.  
  157. Select Map network drive.
  158.  
  159. A Map Network Drive window can seem. Choose a Drive letter and a Folder path.
  160.  
  161. For Drive: choose a drive not already in use on your laptop.
  162.  
  163. For Folder: your department or IT support ought to offer a path to enter during this box. An example for format would be: file-server.sam.digipru.edufileshare for Windows which will connect to:ad.digipru.edusaminstructionalmirde876 (net ID)
  164.  
  165. To connect mechanically at any time, check the Reconnect at logon box.
  166.  
  167. Check Connect victimization totally different credentials.
  168.  
  169. Click end.
  170.  
  171. A Windows Security box can arouse login data for the network file share.
  172.  
  173. If the association is in, a drive for the network file share can seem.
  174.  
  175. -Access shared folder and create a few webpages.
  176.  
  177. In Gnome the best manner is to press ALT+F2 to observe the run dialog and kind smb:// followed by the science address and therefore the folder name. Linux mechanically detects and connects to Windows networks. In Gnome, by about to Places so Network you’ll mechanically see all the Windows networks. You’ll then navigate through the Windows networks and connect with the shared folder. This can be a straightforward thanks to manage your shared folders if you have got several Windows networks with shared folders.
  178.  
  179. -Display webpages through a web browser.
  180.  
  181. If you know basic HTML tags, you can create a notepad file, put the desired data in it & change it’s extension to html. The file when opened next time after you save it will be opened in a web browser. Even if there’s data in file & no HTML tag is used the file would still be opened but a blank page would appear in the browser.
  182.  
  183. For Linux client
  184.  
  185. -Create directory /disk2 mounted to a second disk added to the VM
  186.  
  187. mkdir /disk2
  188.  
  189. mount -t ext2 /dev/hdb1 /disk2
  190.  
  191. -Mount directory /webfiles to the share on Windows server.
  192.  
  193. mkdir ~/mounts/ webfiles
  194.  
  195. sudo mount.cifs //hostname/webfiles ~/mounts/webfiles -o user=username
  196.  
  197. -Access Windows shared folder.
  198.  
  199. mkdir /mnt/share
  200.  
  201. mount -t cifs //windowsmachineip/webfiles -o username=user,password=urPassword /mnt/share
  202.  
  203. -Display IIS webpages through a web browser.
  204.  
  205. lynx file://localhost/FULL/PATH/FILENAME
  206.  
  207. lynx path/filename.html
  208.  
  209. lynx –trace www.indowebster.com
  210.  
  211. For Windows server with file sharing and IIS
  212.  
  213. -Create a group for developers populated with a few users.
  214.  
  215. Group Creation: dsadd group <GroupDN> -samid<SAMName> -secgrp {yes|no} -scope {l|g|u}
  216.  
  217. User Add in Group: dsmod group <GroupDN> -addmbr <MemberDN>
  218.  
  219. IIS 7 additionally makes the method of configuring via application pool identity and creating all necessary changes easier. Once IIS starts an employee method, it must produce a token that the method can use. Once this token is made, IIS mechanically adds the IIS_IUSRS membership to the employee processes token at runtime. The accounts that run as ‘application pool identities’ not ought to be an exact a part of the IIS_IUSRS group. This transformation helps you to line up your systems with fewer obstacles and makes your overall expertise additional favorable.
  220.  
  221. If you would like to disable this feature and manually add accounts to the IIS_IUSRS group, disable this new feature by setting the manualGroupMembership worth to true. The subsequent example shows however this may be done to the defaultAppPool
  222.  
  223. <applicationPools>
  224.  
  225. <add name=”DefaultAppPool”>
  226.  
  227. <processModel manualGroupMembership=”true” />
  228.  
  229. </add>
  230.  
  231. </applicationPools >
  232.  
  233. -Share web directory.
  234.  
  235. appcmd set vdir /vdir.name: string /physicalPath: string
  236.  
  237. appcmd set vdir /vdir.name: contoso / networking / images /physicalPath: C:Pictures
  238.  
  239. By default the Windows Server web site is located at
  240. C:INETPUBWWWROOT.
  241.  
  242. Files stored at that location will be accessible from the server’s web site at its DNS address, e.g.
  243.  
  244. http://server.newdomain.com.
  245.  
  246. Subfolders like
  247. C:INETPUBWWWROOTFOLDER
  248.  
  249. Would be accessed as
  250.  
  251. http://server.newdomain.com/folder.
  252.  
  253. Other folders which are not subfolders of
  254. C:INETPUBWWWROOT
  255.  
  256. -Allow the developers group to write to the share, give read access to others.
  257.  
  258. In the group Policy Management Console (GPMC) console tree, expand the group Policy Objects node within the forest and domain containing the group Policy object (GPO) that you wish to feature or take away permissions.
  259.  
  260. Click the GPO.
  261.  
  262. In the results pane, click the Delegation tab.
  263.  
  264. Click Add.
  265.  
  266. In the choose User, Computer, or group panel, click Object types, choose the kinds of objects that you wish to feature GPO permissions, then click OK.
  267.  
  268. Click Locations, choose either Entire Directory or the domain or structure unit containing the thing that you wish to feature GPO permissions, then click OK.
  269.  
  270. In the Enter the thing name to pick out box, sort the name of the thing that you wish to feature GPO permissions by performing arts one in all the subsequent actions:
  271.  
  272. If you recognize the name, sort it then click OK.
  273.  
  274. To search for the name, click Advanced , sort the search criteria, click realize currently , choose the name within the list box, click OK , then click OK once more. In the Permissions box of the Add group or User panel, choose the suitable permissions from the drop-down list, then click OK.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement