Windows File Sharing and Printer Sharing with SAMBA

From ITCwiki
Jump to navigation Jump to search

Windows File Sharing and Printer Sharing with SAMBA


Samba provides file and print services for various Microsoft Windows clients and can integrate with a Windows Server domain, either as a Primary Domain Controller (PDC) or as a domain member. It can also be part of an Active Directory domain. Samba runs on most Unix and Unix-like systems, such as Linux, Solaris, AIX and the BSD variants, including Apple's Mac OS X Server.

How to use Linux to share your printer and windows file shares:


GUI version:

Start by logging into Ubuntu and go to Applications –> Ubuntu Software Center.

How to install Samba 1.jpg

Then search for and install ‘Samba’ (This will install the Samba GUI)

How to install Samba 2.jpg

After installing, go to System —> Administration –> Samba.

How to install Samba 3.jpg

Select ‘Preferences –> Server Settings’ Then type the Workgroup Name to match your Windows Workgroup Name and click OK.

How to install Samba 4.jpg

After that, select ‘Preferences –> Samba Users’ Click Add User, then select the User account from the drop-down list and add the Windows Username and Samba Password. (Samba Username and Password can be Ubuntu password)

How to install Samba 5.jpg

When you’re done, click ‘File –> Add Share’ or the green + icon then type/browse the directory (folder) you wish to share. Also enter the ‘Share name’, then select ‘Writable and Visible’. Select the ‘Access’ tab, then choose the user you want to access the shares, then click OK.

How to install Samba 6.jpg How to install Samba 7.jpg


For printer sharing you need have a printer installed.

Go to System —> Administration –> Printing then click on Server Settings, and check the “Share published printers connected to this system” checkbox. Also select “Allow users to cancel any jobs” click Apply to close the window.

How to share printer 1.jpg How to share printer 2.jpg

When you’re done, click ‘Server –> New -> Printer’ or the green + icon to select the printer you want to share.

How to share printer 3.jpg

On Linux clients login and go to System —> Administration –> Printing then check “Show shared printers from other systems” checkbox, then hit Apply. Then click “Refresh Printer Queues” button. You should now be able to see any of the shared printer(s) from the server computer.

How to share printer 4.jpg How to share printer 5.jpg


Restart both computers and you should be able to view shares and print from both computers.


Command Line version:

First open a command prompt and elevate your privileges. You can use sudo bash or su followed by your corresponding password.

Next enter the commands shown: aptitude install samba (This will install the core program; follow the default prompts)

Create a Samba password for yourself with the command (substitute USERNAME for your own name): smbpasswd -a USERNAME

Create or locate a folder you want to share, then edit the Samba configuration file with the command: gedit /etc/samba/smb.conf

Once smb.conf has loaded, add this to the very end of the file (note! Test is the name of the folder to be shared):

[test]

path = /home/USERNAME/test

available = yes

valid users = USERNAME

read only = no

browsable = yes

public = yes

writable = yes

(There should be no spaces between the lines, and note also that there should be a single space both before and after each of the equal signs.)

Restart the machine. And you are done.


References:

http://www.liberiangeek.net/2010/05/share-filesfolders-between-windows-xp-vista-7-and-ubuntu-10-04-lucid-lynx-via-samba/

http://blog.mypapit.net/2008/05/enable-printer-sharing-with-ubuntu-computers.html

http://ubuntuforums.org/showthread.php?t=1502265

http://attackcomputerwiz.blogspot.com/2010/06/connecting-ubuntu-1004-to-windows-7.html

http://www.jonathanmoeller.com/screed/?p=1590

http://www.unixmen.com/linux-tutorials/566-install-samba-server-in-ubuntu-karmic

http://en.wikipedia.org/wiki/Samba_(software)