<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>gHacks Technology News &#124; Latest Tech News, Software And Tutorials &#187; smbclient</title> <atom:link href="http://www.ghacks.net/tag/smbclient/feed/" rel="self" type="application/rss+xml" /><link>http://www.ghacks.net</link> <description>A technology news blog covering software, mobile phones, gadgets, security, the Internet and other relevant areas.</description> <lastBuildDate>Sat, 11 Feb 2012 09:52:46 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>Connect to your Samba server from Linux</title><link>http://www.ghacks.net/2009/11/04/connect-to-your-samba-server-from-linux/</link> <comments>http://www.ghacks.net/2009/11/04/connect-to-your-samba-server-from-linux/#comments</comments> <pubDate>Tue, 03 Nov 2009 23:03:42 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Advanced]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[GNOME]]></category> <category><![CDATA[samba]]></category> <category><![CDATA[samba shares]]></category> <category><![CDATA[smb.conf]]></category> <category><![CDATA[smbclient]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=18072</guid> <description><![CDATA[I have written a few articles on Samba here on Ghacks. And most people know how to connect to Samba shares via Windows. Generally speaking (when all is set up correctly) it&#8217;s just a matter of opening up Explorer and entering \\ADDRESS_OF_SAMBA_SERVER\SHARENAME to get to your Samba shares. But what about in Linux? How do [...]]]></description> <content:encoded><![CDATA[<p>I have written a few articles on Samba here on Ghacks. And most people know how to connect to Samba shares via Windows. Generally speaking (when all is set up correctly) it&#8217;s just a matter of opening up Explorer and entering \\ADDRESS_OF_SAMBA_SERVER\SHARENAME to get to your Samba shares. But what about in Linux? How do you go about connecting to Samba shares with the same operating system that is running the Samba server?</p><p>One would think that an easy task. It actually is, once you know how it is done. Â And in this article I am going to show you two different ways of making the connection to your Samba server. You will need to have a working knowledge of how the Samba server is set up as well as a username/password configured on the Samba server. There are also a few steps to take on the desktop for one certain method of connection.</p><p>The two methods I will describe are: Using GNOME&#8217;s Connect To Server dialog and the command line. The latter will be used to show you how to set up auto mounting for Samba.</p><p><span
id="more-18072"></span></p><p><strong>The graphical method</strong></p><div
id="attachment_18074" class="wp-caption alignleft" style="width: 190px"><a
rel="attachment wp-att-18074" href="http://www.ghacks.net/2009/11/04/connect-to-your-samba-server-from-linux/connect_to_server/"><img
class="size-thumbnail wp-image-18074 " src="http://www.ghacks.net/wp-content/uploads/2009/11/connect_to_server-300x300.png" alt="Figure 1" width="180" height="180" /></a><p
class="wp-caption-text">Figure 1</p></div><p>If you take a look at the GNOME Places menu you will see an entry labeled &#8220;Connect to server&#8230;&#8221;. This is what you want to use in order to connect to your Samba server. When you click on that a new window will open. From the Service type drop-down select &#8220;Windows share&#8221; (see Figure 1).</p><p>When you select that entry some of the configuration options will change. As you can see (in Figure 1), I have entered the necessary options to connect to a Samba server on my internal network. You will want to replace the information so it reflects your needs. The only tricky bit of information might be the Folder entry. If you are connecting to the root directory on the share you will not need to enter anything there. Say, for instance, you share is <strong>/media/samba/user<em>. </em><span
style="font-weight: normal">If you want to connect to that directory leave the Folder entry blank. Say, however, you want to connect directly to a sub-folder within that share &#8211; you can enter that folder here. This, of course, isn&#8217;t needed because you can always traverse the sub-directories with simple navigation.Â <span
style="background-color: #ffffff"><strong><span
style="font-weight: normal">You can also choose to add a bookmark instantly, from in this window. </span></strong></span></span></strong></p><p><strong><span
style="font-weight: normal"><span
style="background-color: #ffffff"><strong><span
style="font-weight: normal"> </span></strong></span></span></strong></p><p><strong><strong> </strong></strong></p><p><strong><strong> </strong></strong></p><div
id="attachment_18075" class="wp-caption alignright" style="width: 190px"><a
rel="attachment wp-att-18075" href="http://www.ghacks.net/2009/11/04/connect-to-your-samba-server-from-linux/connect_to_server_password/"><img
class="size-thumbnail wp-image-18075 " src="http://www.ghacks.net/wp-content/uploads/2009/11/connect_to_server_password-300x300.png" alt="Figure 2" width="180" height="180" /></a><p
class="wp-caption-text">Figure 2</p></div><p>Once you have all of the information entered click Connect and you will be greeted with a new window that requires you to enter a password. Also, if you do not supply a Domain name in the previous window, you will be required to enter it here.</p><p>You can also set this up to remember your password either until you logout or until, well, forever. Once you have entered the password/domain click the Connect button and a new Nautilus window will open inside of your Samba Share.</p><p><strong>Using the command line</strong></p><p>Now we&#8217;re going to use the command line to accomplish a similar goal. The biggest difference is that we are going to actually mount the Samba share into another directory, very much the same way we would mount a second hard drive.</p><p>There are a few pieces to put together before we actually take care of the mounting. First let&#8217;s create a directory that the Samba share will be mounted to. So from the terminal window issue the following command:</p><p><em>sudo mkdir /media/samba</em></p><p>Now let&#8217;s make sure our users can read/write to this directory with the command:</p><p><em>sudo chmod -R u+rw /media/samba</em></p><p>Okay now let&#8217;s make sure we can see the Samba shares from the command line. We&#8217;ll do that with the <em>smbclient </em>command like so:</p><p><em>smbclient -L //SAMBA_SERVER_ADDRESS</em></p><p>Where <em>SAMBA_SERVER_ADDRESS</em> is the actual IP address of the Samba server.</p><div
id="attachment_18089" class="wp-caption alignleft" style="width: 190px"><a
rel="attachment wp-att-18089" href="http://www.ghacks.net/2009/11/04/connect-to-your-samba-server-from-linux/smbclient/"><img
class="size-thumbnail wp-image-18089 " src="http://www.ghacks.net/wp-content/uploads/2009/11/smbclient-300x300.png" alt="Figure 3" width="180" height="180" /></a><p
class="wp-caption-text">Figure 3</p></div><p>You will be prompted for your username and password. If you get an error it could be that the usernames don&#8217;t match on each end. If that&#8217;s the case you could add the <em>-U </em>switch to the command like so:</p><p><em>smbclient &#8211;user=jlwallenÂ -L Â //SAMBA_SERVER_ADDRESS</em></p><p>You should see output similar to that shown in Figure 3.</p><p>Now it&#8217;s time to try to mount the Samba share to the <strong>/media/samba</strong> directory. To do this issue the command:</p><p><em>sudo mount -t cifs //SAMBA_SERVER_ADDRESS/SHARE -o username=USERNAME /media/samba/</em></p><p>Where:</p><ul><li><span
style="background-color: #ffffff">SAMBA_SERVER_ADDRESS is the IP address of the Samba server.</span></li><li><span
style="background-color: #ffffff">SHARE is the share name.</span></li><li><span
style="background-color: #ffffff">USERNAME is the username to connect with.</span></li></ul><p>If that works you can now make this an automated mount by adding the following line to your <strong>/etc/fstab</strong> file:</p><p><code>//SAMBA_SERVER_ADDRESS/SHARE Â  Â  /media/samba Â  Â cifs Â credentials=/etc/samba/user.cred 0 0 </code></p><p>Where SAMBA_SERVER_ADDRESS is the IP address of the Samba server and SHARE is the share name.</p><p>Notice the user.cred file. This is one last thing we need to create. With your text editor create this file and place into it:</p><p><em>username=USER</em></p><p><em>password=PASSWORD</em></p><p>Where USER is the username to log in with and PASSWORD is the password to use for authentication. The final step is the give this new file the proper permissions with the command:</p><p>sudo chmod 600 /etc/samba/user.cred</p><p>You can ensure this works by issuing the command <em>mount -a</em> which should mount your Samba share.</p><p><strong>Final thoughts</strong></p><p>You should now have an auto-mounting Samba share &#8211; or the ability to easily connect your GNOME desktop to a Samba share. Samba is a very powerful tool that not only can share files with Windows machines, but with Linux machines as well.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/11/04/connect-to-your-samba-server-from-linux/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Auto mounting a Samba share in Linux</title><link>http://www.ghacks.net/2009/04/19/auto-mounting-a-samba-share-in-linux/</link> <comments>http://www.ghacks.net/2009/04/19/auto-mounting-a-samba-share-in-linux/#comments</comments> <pubDate>Sun, 19 Apr 2009 17:30:32 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Networks]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[Tutorials Advanced]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[automount]]></category> <category><![CDATA[fstab]]></category> <category><![CDATA[samba]]></category> <category><![CDATA[samba share]]></category> <category><![CDATA[smbclient]]></category> <guid
isPermaLink="false">http://www.ghacks.net/2009/04/19/auto-mounting-a-samba-share-in-linux/</guid> <description><![CDATA[So you have that Samba server up and running and you can connect to it from Windows and Mac with ease. But when you turn to another Linux box that doesn&#8217;t have Konqueror, Nautilus, or Dolphin you can&#8217;t figure out the riddle of connecting. Or maybe you want to have this share mounted at boot [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://www.ghacks.net/wp-content/uploads/2009/04/logo-samba.gif"><img
class="alignleft size-full wp-image-12179" src="http://www.ghacks.net/wp-content/uploads/2009/04/logo-samba.gif" alt="logo-samba" width="200" height="103" /></a>So you have that Samba server up and running and you can connect to it from Windows and Mac with ease. But when you turn to another Linux box that doesn&#8217;t have Konqueror, Nautilus, or Dolphin you can&#8217;t figure out the riddle of connecting. Or maybe you want to have this share mounted at boot time? How do you manage it?</p><p>From the command line of course. Yes there are plenty of GUI tools that will allow you to connect to a Samba share easily, but they don&#8217;t help you set up anything to connect automatically. For that you will need to employ a few command line tools. But once it is finished, your system will be seamless.</p><p><span
id="more-12178"></span><strong>What you will need</strong></p><p>First I am going to assume you have your Samba server set up and you are able to connect to it from other machines. Outside of that you will need only one piece of software installed on your Linux machine: smbclient. This will be in your distributions&#8217; repositories so just open up your Add/Remove Software utility, search for smbclient, select it, and click Apply.</p><p>Once smbclient is installed you are ready to go.</p><p><strong>A test</strong></p><p>Let&#8217;s first test to make sure your Linux box can see the Samba share. You will need either sudo or root access to do this. Issue the command:</p><p>smbclient //IP_TO_SAMBA_SERVER/SHARE_NAME -U USERNAME</p><p>Where:</p><ul><li>IP_TO_SAMBA_SERVER is the IP address of your Samba server.</li><li>SHARE_NAME is the share you want to connect to.</li><li>USERNAME is the user name you connect to the share with.</li></ul><p>If all is well you should see something like this:</p><p><em>Enter wallenmusic&#8217;s password: </em><em></em></p><p><em>Domain=[MONKEYPANTZ] OS=[Unix] Server=[Samba 3.2.5]</em></p><p><em>smb: \&gt;</em></p><p>If you see that you can type <em>quit </em>and then hit the Enter key to escape this prompt.</p><p><strong>Setup</strong></p><p>The first thing you need to do is create a directory to mount the Samba share to. I created the directory <strong>/data<em> </em></strong>with the command:</p><p><em>sudo mkdir /data</em></p><p>Once that directory is created you can then mount it with the command:</p><p>mount -t smbfs -o username=USERNAME //IP_TO_SAMBA_SERVER/SAMBA_SHARE /data</p><p>Where:</p><ul><li>IP_TO_SAMBA_SERVER is the IP address of your Samba server.</li><li>SHARE_NAME is the share you want to connect to.</li><li>USERNAME is the user name you connect to the share with.</li></ul><p>Now if you check the <strong>/data</strong> directory you should see a listing of the contents of the Samba share.</p><p><strong>Automount</strong></p><p>Let&#8217;s make that share automount at boot. This will require editing your <strong>/etc/fstab</strong> file, adding an entry for this Samba share. In this file (again you will have to have either root or sudo access) you will add a line like this:</p><p><code>//IP_TO_SAMBA_SERVER/SAMBA_SHARE  /data smbfs username=USERNAME,password=PASSWORD, 0 0</code></p><p>Where:</p><ul><li>IP_TO_SAMBA_SERVER is the IP address of your Samba server.</li><li>SHARE_NAME is the share you want to connect to.</li><li>USERNAME is the user name you connect to the share with.</li><li>PASSWORD is the password for the Samba user</li></ul><p>Once that entry is saved unmount the <strong>/data </strong>directory with the command:</p><p>umount /data</p><p>so you can test your automount entry.</p><p>Now, enter the command:</p><p>mount -a</p><p>If there are no errors you should see the contents of the Samba share in the <strong>/data</strong> directory.</p><p>That&#8217;s it. Congratulations, you now have an automounted Samba share on your Linux machine.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/04/19/auto-mounting-a-samba-share-in-linux/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> </channel> </rss>
