Samba Active Directory Integration

292

6. Samba Active Directory Integration

6.1. Accessing a Samba Share Another, use for Samba is to integrate into an existing Windows network. Once part of an Active Directory domain, Samba can provide file and print services to AD users. The simplest way to join an AD domain is to use Likewise-open. For detailed instructions see the Likewise Open Installation and Administration Guide 27 . Once part of the Active Directory domain, enter the following command in the terminal prompt: sudo apt-get install samba smbfs smbclient Next, edit etcsambasmb.conf changing: workgroup = EXAMPLE ... security = ads realm = EXAMPLE.COM ... idmap backend = lwopen idmap uid = 50-9999999999 idmap gid = 50-9999999999 Restart samba for the new settings to take effect: sudo restart smbd sudo restart nmbd You should now be able to access any Samba shares from a Windows client. However, be sure to give the appropriate AD users or groups access to the share directory. See Section 4, “Securing a Samba File and Print Server” [p. 283] for more details. 6.2. Accessing a Windows Share Now that the Samba server is part of the Active Directory domain you can access any Windows server shares: • To mount a Windows file share enter the following in a terminal prompt: mount.cifs fs01.example.comshare mount_point It is also possible to access shares on computers not part of an AD domain, but a username and password will need to be provided. 27 http:www.likewise.comresourcesdocumentation_librarymanualsopenlikewise-open-guide.html 293 • To mount the share during boot place an entry in etcfstab , for example: 192.168.0.5share mntwindows cifs auto,username=steve,password=secret,rw 0 0 • Another way to copy files from a Windows server is to use the smbclient utility. To list the files in a Windows share: smbclient fs01.example.comshare -k -c ls • To copy a file from the share, enter: smbclient fs01.example.comshare -k -c get file.txt This will copy the file.txt into the current directory. • And to copy a file to the share: smbclient fs01.example.comshare -k -c put etchosts hosts This will copy the etchosts to fs01.example.comsharehosts . • The -c option used above allows you to execute the smbclient command all at once. This is useful for scripting and minor file operations. To enter the smb: \ prompt, a FTP like prompt where you can execute normal file and directory commands, simply execute: smbclient fs01.example.comshare -k Replace all instances of fs01.example.comshare, 192.168.0.5share, username=steve,password=secret, and file.txt with your servers IP, hostname, share name, file name, and an actual username and password with rights to the share. 6.3. Resources For more smbclient options see the man page: man smbclient, also available online 28 . The mount.cifs man page 29 is also useful for more detailed information. The Ubuntu Wiki Samba 30 page. 28 http:manpages.ubuntu.commanpagespreciseenman1smbclient.1.html 29 http:manpages.ubuntu.commanpagespreciseenman8mount.cifs.8.html 30 https:help.ubuntu.comcommunitySamba 294

Chapter 19. Backups