The samba bundle is a meta-package planned to be installed on waiters. Clients do non necessitate this meta-package chiefly it uses when we are moving as a client if we need to entree files on another computing machine. As a illustration, put ining obeche is non necessary if we merely need Ubuntu system to make any of the followers:
Access shared booklets, thrusts and pressmans on a Windows computing machine. To make this, we merely need the smbfs plugin.
Have Windows computing machine usage a pressman that is attached to a Linux computing machine.
CUPS can be configured to do the pressman accessible to the web.
Share directories between two Linux computing machines. we can utilize NFS or setup an waiter on one computing machine and entree it from other computing machines utilizing an scp or sftp client.
Nautilus Integration
If we want to be talented to portion booklets with nautilus the file browser, put in the nautilus-share bundle installed by default in Ubuntu 9.
10 Desktop edition:
sudo apt-get install nautilus-share
Waiter
If we wish our computing machine to move as a Samba waiter act as a file or pressman waiter so put in the obeche bundle
sudo aptitude install obeche
Client
The samba bundle is non needed on clients. Install smbfs alternatively
sudo aptitude install smbfs
If we want to link to a Samba waiter when Windows waiter or an Ubuntu waiter running Samba we have two options, we can utilize the smbclient bid or we can straight mount the obeche file system via smbfs.
Command line
Ubuntu will link to a Samba waiter out of the box via smbclient. This is a similar to a FTP connexion. Once connected, we can utilize bids such as cubic decimeter, cadmium, put, and acquire.
smbfs
This bundle allows clients to mount Samba file portions ; hold to them to move as local discs. Most people will prefer this method.
Server Configuration
For Ubuntu new versions, shared booklets are created straight from the booklet. Browse to the location of the booklet we would wish to portion, right-click the booklet, and take Sharing Options. Snap the Share this booklet cheque box, and click Install Services. Enter the watchword, and the Samba waiter bundles will be downloaded and installed.
Shoping SMB portions
Open the Places Menu, and so snap on Network. We will see a Windows web icon. Double-click to open it. The following window shows all the domains/workgroups found on our web. Inside each domain/workgroup we will see all the computing machines on the domain/workgroup with distribution enabled. Double-click on a computing machine icon to entree its portions and files. Before demoing a computing machine ‘s portions, our system may motivate us for a name and watchword. Fill in the signifier by agencies of the certificates of a valid user for the computing machine we are linking to. We may to boot hive away that watchword in keyring for convenience. However the default installing of Samba does non synchronise watchwords. we may hold to run “ smbpasswd ” for each user that wants to hold entree to his Ubuntu place directory from Microsoft Windows.
Graphic Configuration
This subdivision is for those instead to utilize graphical tools. This subdivision should let us to “ speedy start ” SMB portions between Ubuntu and besides Ubuntu or Windows waiters. The graphical user interface technique is easier to work with, because:
Shares are Public, ( which can brows from Network Places )
A watchword is non set ( for portions which can be mounted by anyone ) .
Be cautiousness we are put ining a waiter and we may wish to put in a Firewall disposal public-service corporation to assist forestall unsought entree. See besides the manual constellation subdivisions below to larn how to “ conceal ” the portions from shoping and put a watchword for entree.
Ubuntu Server
This subdivision enables Ubuntu as a obeche file waiter.
Sharing a Booklet
To portion a directory we must hold permission to entree the directory. Travel to home directory ( Places – & gt ; Home booklet ) . Right chink on the “ Documents ” directory and in the dad up bill of fare select “ Share Folder ” . If obeche is non installed we will acquire a dad up bill of fare “ Sharing services are non installed ” . Select “ Install Windows webs support ( SMB ) ” and deselect “ Install Unix webs support ( NFS ) ” – & gt ; so snap “ Install services ” . If we get an mistake message that the obeche.deb could non be found, open a terminus and update apt-get.
sudo apt-get update
Try once more and Ubuntu will download and put in obeche. Right chink on the “ Documents ” directory and in the dad up bill of fare select “ Share Folder ” . we will acquire a dad up bill of fare “ Share Folder ” . Select “ Windows webs ( SMB ) ” in the pull down bill of fare and give our portion a name in the “ Name ” box. Unselect the “ Read merely ” look into box if we want read/write entree to the portion. Snap the “ Share ” button.
Windows XP Server
This subdivision enables Windows XP as a obeche file waiter.
Sharing a Booklet
1. On the Windows waiter, browse in adventurer ( “ My Computer ” ) to the location of the booklet we wish to portion ( C: Documents and Settings for illustration ) . Following right chink on the booklet to portion and choose “ Sharing and Security… ” . In the pop-up duologue box click the “ Sharing ” check. snap the “ Network Setup Wizard ” to configure the web to allow portions. Work with manner through the ace. Note the default workgroup is MSHOME. We may alter this value if we like but all our computing machines should be in the same workgroup. Finally we will be given the option to “ Turn on file and pressman sharing ” . This is the option we want, continue with the web ace. We will hold to re-start the computing machine for the scenes to take consequence – & gt ; Restart Windows.
2. After bring uping, once more unfastened adventurer ( “ My Computer ” ) and navigate to the booklet we wish to portion. Again right chink on the booklet and choose “ Sharing and Security… ” In the pop-up duologue box click the “ Sharing ” check. In the “ Network sharing and security ” box, tic ( choice with the mouse ) the “ Share this booklet on the web ” box. Give the booklet a portion name. This will give read merely entree to Ubuntu computing machines via obeche. To hold to read/write entree tic ( choice with the mouse ) the “ Allow web users to alter my files ” box. Snap the “ Apply ” button and shut the duologue box.
Connect to a obeche waiter
Configure the Ubuntu or Windows XP obeche waiter as above.
Ubuntu Client
On the Ubuntu client utilizing the bill of fare at the top, travel to “ Topographic points ” – & gt ; “ Network ” . We will see an icon “ Windows web ” and should be able to shop to the shared booklet. We will be asked for a watchword, leave it clean. Snap the “ Connect button. It besides can make with choosing from the bill of fare at the top select “ Location ” – & gt ; “ Connect to a waiter ” . In the “ Service type ” draw down choice “ Windows portion ” . Enter the waiter IP reference in the “ Waiter: ” box and the portion name in the “ Share: ” box. Click “ Connect ” and so “ Connect ” once more on the 2nd duologue box it no demand any watchwords.
If we would wish to mount SMB portion utilizing server hostname instead than the IP Address, edit /etc/hosts and add to samba waiter ( syntax IP Address hostname ) .
192.168.1.100 hostname
Where “ hostname ” = the name of our obeche waiter.
Windows XP Client
On Windows unfastened “ My Computer ” and happen the manner to “ My Network Places ” . Navigate to Ubuntu waiter and portion will be available without a watchword. It besides can make with choosing from the bill of fare at the top select “ Tools ” – & gt ; “ Map Network Drive ” . Select an available missive for our SMB portion. In the “ Booklet: ” box enters samba_server_ipaddressshare. Put a Tic grade with choosing with the mouse the option “ Reconnect at login ” if we want the portion to be automatically mounted when we boot Windows. Click the “ Finish ” box. A duologue box will look, come in the obeche user name and watchword. Click “ OK ” . If we would wish to mount your SMB portion utilizing our waiter hostname instead than the IP Address, edit C: WINDOWSsystem32driversetchosts and add to our obeche waiter ( syntax IP Address hostname ) .
192.168.130.1 hostname
Where “ hostname ” = the name of our obeche waiter.
Samba Client Manual Configuration
These subdivisions cover up how to manually configure and link to a SMB file waiter from an Ubuntu client. smbclient is a bid line tool similar to a ftp connexion while smbfs allows us to mount a SMB file portion. Once a SMB portion is mounted it acts similar to a local hard thrust which we can entree the SMB portion with the file browser.
Connecting to a Samba File Server
Command line
Connecting from the bid line is similar to an ftp connexion.
List public SMB portions with
smbclient -L //server -U user
Connect to a SMB portion with
smbclient //server/share -U user
Enter the user watchword. we can link straight with
smbclient //server/share -U user % watchword
But our watchword will demo on the screen. Then once we connected you will acquire a prompt that looks like this:
smb: & gt ;
Type “ aid ” , without quotation marks, at the prompt for a list of available bids.
CIFS
CIFS is constitutional in the smbfs bundle and is a replacement for smbfs
Allow non-root users to mount SMB portions
By default merely root may mount SMB portions on the bid line. To allow non-root users to mount SMB portions we could put the SUID, but I advise us to configure sudo. We should configure sudo with visudo we may either allow the gruop “ users ” to mount SMB portions, or add a group, obeche, and add users we wish to let to mount SMB portions to the obeche group.
sudo groupadd obeche
sudo adduser user obeche
Change “ user ” to the username we wish to add to the obeche group.
sudo visudo
In the “ group ” subdivision add our group we wish to allow to mount SMB portions
Add a line in the “ group ” subdivision:
# # Members of the admin group may derive root privileges
% admin ALL= ( ALL ) ALL
% obeche ALL= ( ALL ) /bin/mount, /bin/umount, /sbin/mount.cifs, /sbin/umount.cis
The following will mount the myshare booklet on myserver to ~/mnt.it will be besides in our place directory
mkdir ~/mnt
sudo saddle horse -t cifs //myserver_ip_address/myshare ~/mnt -o username=samb_user, noexec
The “ noexec ” option avoids feasible books running from the SMB portion. We will be asked for BOTH our sudo and so our obeche user watchword. To umount,
sudo umount ~/mnt
Auto as if by magic mount SMB portions
In order to hold a portion mounted automatically every clip you reboot, we need to make the undermentioned things besides
With any editor, make a file incorporating the Windows/Samba user history inside informations:
gksu gedit /etc/samba/user
KDE users must utilize kdesu instead than gksu and alternatively of Gedit they can utilize Kwrite as editor. it be supposed to keep two lines as spell after:
username=samba_user
password=samba_user_password
Salvage the file and issue gedit.
Modify the permissions on the file for security:
sudo chmod 0400 /etc/samba/user # permissions of 0400
= read merely
Now create a directory where we want to mount our portion ( e.g./media/samba portion ) :
sudo mkdir /media/samba_share
Now, utilizing any editor, and add a line to /etc/fstab for our SMB portion as follows:
sudo cp /etc/fstab /etc/fstab.bak
gksu gedit /etc/fstab
Add a line for our SMB portion:
//myserver_ip_address/myshare /media/samba_share cifs
credentials=/etc/samba/user, noexec 0 0
The portion will mount automatically when we boot. The “ noexec ” option prevents feasible books running from the SMB portion.
To mount the portion now, without rebooting,
sudo saddle horse /media/samba_share
We can besides unmount the portion with:
sudo umount /media/samba_share
If we wish to increase security at the disbursal of expedience, utilize this line in /etc/fstab
//myserver_ip_address/myshare /media/samba_share cifs noauto, credentials=/etc/samba/user, noexec 0 0
The noexec ” option prevents feasible books running from the SMB portion.
Edit /etc/samba/user, take the watchword ( go forth merely the samba user ) .
Now the portion will NOT automatically mount when we boot and we will be asked for our obeche watchword.
Mount the portion with:
sudo saddle horse /media/samba_share
CIFS may do a shutdown mistake.
CIFS VFS: Server non reacting.
SMBFS
When mounting a portion on the local file system allows us to work around plans that do non up till now use GnomeVFS to shop distant portions transparently. To mount a SMB portion, foremost install smbfs:
sudo apt-get update
sudo apt-get install smbfs
To let non root histories to mount portions, modify the permissions on the smbmnt plan therefore:
sudo chmod u+s /usr/bin/smbmnt /usr/bin/smbumount
The working line in /etc/sudoers is as pursue ( see CIFS subdivision above ) :
% obeche ALL= ( ALL ) /bin/mount, /bin/umount, /sbin/mount.cifs, /sbin/umount.cif
s, /usr/bin/smbmount, /usr/bin/smbumount
This allows any user in the obeche group to mount SMB portions. To this we will necessitate to make a samba group and attention deficit disorder users.
The followers will mount the myshare booklet on myserver to ~/mnt
mkdir ~/mnt
smbmount //myserver/myshare ~/mnt
To umount,
smbumount ~/mnt
In order to hold a portion mounted automatically every clip we reboot, we need to make the followers:
Open a shell as root
sudo -s
Make a file incorporating your Windows/Samba user history inside informations:
sixs /etc/samba/user
It should incorporate as follows:
Change the permissions on the file for security:
chmod 0600 /etc/samba/user
Now create a directory where we need to mount our portion ( e.g. /mnt/data ) :
Now edit the file system tabular array ( /etc/fstab ) and add a line as follows:
//server/share /mnt/data smbfs
credentials=/etc/samba/user, rw, uid=bob 0 0
Where ‘bob ‘ is the non-root user we log into ubuntu with, ‘server ‘ is the name or reference of the Windows device and ‘share ‘ is the name of the portion. To mount the portion now, merely utilize the undermentioned bid as root. It will mount automatically on subsequent reboots.
saddle horse /mnt/data
Samba Server Manual Configuration
Configuration is performed by reading and redacting /etc/samba/smb.conf, the constellation file for the obeche waiter. There are a few graphical tools available such as “ kdenetwork-filesharing ” and “ Swat ” . A reasonably comprehensive graphical Samba constellation tool is available for KDE, by put ining the “ kdenetwork-filesharing ” bundle. Once install, we can happen it by establishing the KDE Control Center. ( Alt-F2 and so type kcontrol ) . Browse to Internet & A ; Network & gt ; Samba. It is reasonably easy to utilize.
The undermentioned tips show how to make some basic things without put ining extra package, utilizing the bid line. It is non hard, merely be careful with misprint. First open a terminus: Applications & gt ; System Tools & gt ; Terminal and open the file smb.conf
sudo nano -w /etc/samba/smb.conf
How to Salvage: To salvage in nano usage “ CTRL-O ” , so “ CTRL-X ” .
Tip: Replacing nano with gedit gives us a nice graphical editor.
The file *smb.conf* is divided in several subdivisions:
Debugging/Accounting
Authentication
Printing
File sharing
Misc
Share Definitions
Global Settings
Let ‘s get down with Global Settings. It will see several lines, which we can besides see in the graphical web tool like workgroup and wins server. If we changed everything to our wishing already so we can jump this subdivision, if non alter to what we need. If we do non cognize what points mean, . It will salvage our trouble-shooting subsequently.
File Sharing ( Basics )
The of import portion for us is File sharing. Samba portions are named in brackets, [ ] , and configured by adding options in the lines that follow. Most options are Boolean. It means there are two options with “ yes ” and “ no ”
We have to alter:
[ places ]
remark = Home Directories
browseable = no
# By default, the place directories are exported read-only.
Change following
# parametric quantity to ‘yes ‘ if we want to be able to compose to them.
writable = no
This describes our /home booklet. Normally we want to portion this booklet in a home-environment, because these are the files we want to portion. To make so, make the undermentioned alterations:
[ places ]
remark = Home Directories
browseable = yes
# By default, the place directories are exported read-only.
Change following
# parametric quantity to ‘yes ‘ if we want to be able to compose to them.
writable = yes
This finishes sharing the booklet. The last thing we need to make is repairing a user.
Add users who can entree our portions with the ‘smbpasswd ‘ bid.
sudo smbpasswd -a username
New SMB watchword:
Retype new SMB watchword:
Added user username.
The username used here should be a existent user apparatus on our PC/Server. Reload Samba for every alteration to users/passwords or ‘smb.conf ‘
sudo /etc/init.d/samba reload
File Sharing ( Advanced )
We started with the base of Samba file-sharing. The above-named points should be plenty to acquire you started. Next we will add inside informations that you might or might non necessitate.
If we have more than one web card
If we have more than one web card so we have to specify where we want Samba to run. In smb.conf under the [ planetary ] subdivision, attention deficit disorder:
interfaces = 127.0.0.1, 192.168.0.31/24
bind interfaces merely = yes
The first reference ( 127.0.0.1 ) , is a loopback web connexion ( it ‘s our ain machine ) . The 2nd reference ( 192.168.0.31 ) , is the reference of the card we want Samba to run on, the 2nd figure ( 24 ) is the subnet default for a CLASS-C web. It may change depending on the web.
With “ bind interfaces merely ” we limit which interfaces on a machine will function SMB petitions.
We can restrict which IP reference can link to our Samba waiter adding these lines:
hosts allow = 127.0.0.1, 192.168.0.31, 192.168.0.32
hosts deny = 0.0.0.0/0
The loopback reference must be present in the first line. The 2nd line deny entree from all IP reference non in the first line.
Private and public portions in same config
First we ‘ll desire to put this up in the [ planetary ] subdivision of our smb.conf
[ planetary ]
security = user
encrypt watchwords = true
map to guest = bad user
guest history = cipher
securityA =A user restricts logins to users on the waiter. encryptA passwordsA =A true is necessary for most modern versions of Windows to login to portions. mapA toA guestA =A badA user will map login efforts with bad user names to the invitee history we specify with guestA accountA =A cipher. That is, if we attempt to login to the portion with a user name non set up with smbpasswd the we will be logged in as the user
Next the private portion
[ private ]
remark = Private Share
way = /path/to/share/point
browseable = no
read merely = no
If browsable is set to no the portion will non demo up on graphical browsers such a “ My Network Places ” on Windows or Places – & gt ; Network on Ubuntu.
Way is the way to the directory that we need to portion out. browseableA =A no will hold the portion non demo up when users browse the web. readA onlyA =A no will allow we, as an attested user, compose to the portion.
Finally, the public portion
[ public ]
remark = Public Share
way = /path/to/share/point
read merely = no
guest merely = yes
guest all right = yes
Again, way is the way to the directory that we want to portion out. readA onlyA =A no will let users to compose to this portion. guestA onlyA =A yes and guestA okA =A yes will let invitee logins and besides force users to login as invitees. The user you specified with guestA history in the [ planetary ] subdivision must hold write permissions on /path/to/share/point in order to compose files to the portion.
At what clip Windows efforts to entree a SMB portion it will utilize the current Windows user name and watchword. The mapA toA guestA =A badA user fast ones above license entree to the populace portion merely if you give Samba an wrong user name. If you give it a valid user name, but a bad watchword, the login will neglect and Windows will give us a watchword prompt when you try to entree the portion. If you have the same user name for our Windows machine and our Ubuntu machine, we could be inadvertently giving the Samba server a valid user name, but invalid watchword. To decide this we will either hold to alter the Windows user name, or to take that user name from the Samba watchword file with sudoA smbpasswdA -xA [ username ] .
The above utilizations securityA =A user. To entree the private portions you will hold to do certain the user exists in smbpasswd. These users must besides already exist as normal users on your machine. You add users to smbpasswd merely by running sudoA smbpasswdA -aA [ username ] and giving a watchword.
Puting permissions
To put permissions of freshly created paperss / files edit /etc/samba/smb.conf and in the [ planetary ] subdivision attention deficit disorder:
create mask = 0644
directory mask = 0755
Sharing CUPS Printers
Graphic Configuration
Setup Ubuntu Print Server
In your bill of fare go to System – & gt ; Administration – & gt ; Printing
Under “ Local Printers ” on the left, select the pressman you wish to portion. Choose the “ Policies ” check on the right and do certain the “ Shared ” box is selected.
Ubuntu Client
Again travel to System – & gt ; Administration – & gt ; Printing
Click “ New Printer ” in the upper right. In the following bill of fare select “ Windows Printer via SAMBA ” . Now enter your Ubuntu Samba Print Server ( set up as above ) IP reference in the box on the left titled “ smb: // ” . Snap the “ Browse ” button.
Choose the pressman in the “ SMB Browser ” window ( Click on the small pointers ) . Once you have selected your pressman, look into the “ Authentication required ” and come in your obeche user name and watchword. Then click the “ Verify ” button. You should see verification that the portion is available.
Click the “ Forward ” button and put in the drivers for your pressman as you would for any other pressman.
Windows Client
Travel to Control Panel – & gt ; Printers
Click “ Add a pressman ” on the upper left. The pressman ace will get down – & gt ; click forward. Select Network Printer and snap “ Following ” . Select “ Browse for a pressman ” ( Top button ) and click “ Following ” . In the following window, navigate to your Ubuntu Samba Print Server and snap “ Following ” . Continue with the pressman and driver installing.
Manual Server Configuration
If You would wish to portion Your pressmans make the undermentioned alterations to Samba:
If non already done make the Samba-user You want the portion to be used by.
In smb.conf uncomment and alter the lines stoping up with the undermentioned constellation:
# # # # # # # # # # Printing # # # # # # # # # #
# If you want to automatically lade your pressman list instead
# than puting them up separately so you ‘ll necessitate this
burden pressmans = yes
# [ … ] // Some BSD printing material, do non redact if You do non necessitate to
# CUPS printing. See besides the cupsaddsmb ( 8 ) manpage in the
# cupsys-client bundle.
publishing = cups
printcap name = cups
and in the Share Definitions subdivision append and/or modify the [ pressmans ] portion stoping up like this:
# ======================= Share Definitions =======================
# [ … ] // File and Folder sharing, do non redact if You do non necessitate to
[ pressmans ]
remark = All Printers
browseable = no
way = /tmp
printable = yes
public = yes
writable = no
create manner = 0700
printcap name = /etc/printcap
print bid = /usr/bin/lpr -P % p -r % s
publishing = cups
Some account what is done:
the [ pressmans ] portion defines the default-behavior for all the pressmans that are mentioned in “ printcap name ” . A kind of templet how to make portions for these pressmans. This templet is applied if “ burden pressmans ” is set to true. For more elaborate account refer to the Samba certification.
And make non bury to recharge Samba:
sudo /etc/init.d/samba reload
Procuring Samba
This subdivision was started to give some general advise on security considerations and is non an thorough reappraisal of samba security.
/etc/samba/smb.conf
Networking Section – usage “ hosts allow ” and “ hosts deny ”
# hosts allow = 127.0.0.1 192.168.1.0/24
hostal let = 127.0.0.1 192.168.1.1 192.168.1.2
hosts deny = 0.0.0.0/0
hosts deny 0.0.0.0/0 = all others.
Shares
When specifying a portion, see the followers options:
browseable = no ~ Shares will non demo up when shoping your web.
users = user1 user2 ~ List of users able to entree the portion
When puting up a Samba portion, you can restrict the users who have entree to your portion
[ private ]
remark = Private Share
way = /path/to/share/point
browseable = no
read merely = no
valid users = user1 user2 user3
Now merely samba users user1, user2, and user3 will hold entree to the portion “ private ” .
Firewall
Configure your firewall ( iptables ) to restrict entree to your waiter. Samba uses ports
UDP ports 137 and 138
TCP ports 139 and 445
Trouble-shooting Samba
A common job when trying to entree a SMB portion from a Windows computing machine is “ System Error 53 ” after trying to “ Net Use ” .
The first thing you should make, before looking into your conf files, is guarantee that the directory you are sharing really exists.
If you are holding jobs with Samba users, look into the bid pdbedit
Tips / Permissions
Samba permissions are sometimes a small tricky.
Server side
The name of your obeche portion is the word on the [ ] [ private ] = portion name of “ private ” . [ secret ] = portion name of “ secret ” .
To be able to mount the obeche portion, obeche users on the waiter must hold permission to entree the directory.
If /path/to/share/point in “ way = /path/to/share/point ” is owned by root.root with permissions of 770, merely root will be able to mount the portion.
Client side
If you do non user a certificates file, do non bury to stipulate your samba_user at the clip of mounting ( -o username=samba_user ) .
Permissions on a obeche portion depend on the Server.
Linux waiters will honour full Linux permissions.
Windows portions do non back up Linux permissions. Set permissions at the clip of mounting the obeche portion with the options file_mode=660 and dir_mode=770 ( these are permissions and non umask values ) :
file_mode=arg
If the waiter does non back up the CIFS Unix extensions this overaˆ?
rides the default file manner.
dir_mode=arg
If the waiter does non back up the CIFS Unix extensions this overaˆ?
rides the default manner for directories.
These options will be used for all files and directories on the ( Windows ) obeche portion and can non be changed.
Permissions of new files on the obeche portion are set by your umask.
To mount your samba portions via ( waiter ) hostname instead than IP Address, add an entry for your waiter in /etc/hosts ( C: WINDOWSsystem32driversetchosts for Windows ) .