Networking and sharing files in Ubuntu

   1 [10:01] <pleia2> now we welcome dnivra for a class on Networking and sharing files in Ubuntu :)
   2 [10:01] <dnivra> thanks pleia2 !
   3 [10:02] <dnivra> Hello everyone. I'm dnivra and welcome to this session on “Networking and Sharing Files in Ubuntu”.
   4 [10:02] <dnivra> If you have any questions at any point of time, ask at #ubuntu-classroom-chat and I shall try to answer them as much as possible.
   5 [10:02] <dnivra> so let's begin.
   6 [10:03] <dnivra> Here's a scenario: you want to browse the video collection of your friend and copy few that you like.
   7 [10:03] <dnivra> BUT, your friend is busy doing some important work on his computer so you can't use it and you don't have a hard disk to copy all videos to view at your own leisure.
   8 [10:03] <dnivra> In this session, I will introduce a simple and easy to do solution-how to connect two computers over LAN(Local Area Network) and share files between them using samba.
   9 [10:04] <dnivra> Note that this is a very basic method, to be used when you want to share files instantly and recommended for a short period only.
  10 [10:04] <dnivra> That is there can be issues(say security) with this method.
  11 [10:05] <dnivra> I just think going into those details would be rather overwhelming at this stage. So we will just stick to the basics of this.
  12 [10:05] <dnivra> For sharing files you will need
  13 [10:05] <dnivra> 2 computers :)
  14 [10:06] <dnivra> a LAN cable,
  15 [10:06] <dnivra> and an internet connection on either computer.
  16 [10:06] <dnivra> this computer will act as the server, while other as client.
  17 [10:06] <dnivra> oh and you need sudo privilege on the server as well.
  18 [10:07] <dnivra> If you have two laptops/desktops with wireless cards, you don't need a LAN cable-you can settle for a wireless connection.
  19 [10:07] <dnivra> But, I strongly suggest using LAN owing to higher transfer rates.
  20 [10:07] <dnivra> so for starters, let's install samba.
  21 [10:07] <dnivra> To do so, please run the command “sudo apt-get install samba” in the terminal.
  22 [10:08] <dnivra> Alternatively, you can install samba from Synaptic Package Manager(System -> Administration -> Synaptic Package Manager).
  23 [10:08] <dnivra> but i prefer command line, sort of easier and hassle free.
  24 [10:08] <dnivra> note that you'll need samba installed on both machines.
  25 [10:09] <dnivra> While samba is being installed, let us configure the network and establish a connection.
  26 [10:09] <dnivra> To do so, right click on the network manager icon on the top panel and select “Edit Connections”.
  27 [10:09] <dnivra> You'll be greeted by the Network Connections window, in which the Wired tab would be selected.
  28 [10:10] <dnivra> In the Wired tab, create a new connection by clicking on “Add”.
  29 [10:10] <dnivra> I recommend this over using Auto eth0 connection just in case anything gets messed up, you still have Auto eth0.
  30 [10:11] <dnivra> For those connecting via wireless, choose the wireless tab and create the connection by clicking on “Add”.
  31 [10:11] <dnivra> Those who have a DHCP server running on local network can avoid the following step and hit the “Apply” button.
  32 [10:12] <dnivra> If you are unsure, follow the next step(recommended for all).
  33 [10:12] <dnivra> On clicking add, a window pops up asking you to specify the properties of the connection.
  34 [10:12] <dnivra> (I'm not going to cover security of the connection-it'd require a lot more time.)
  35 [10:12] <dnivra> Choose the “IPv4 Settings” tab in the window that just popped up.
  36 [10:13] <dnivra> “Method” is set to “Automatic(DHCP)” by default. Choose “Manual” from the box. The “Addresses” box just below will become active.
  37 [10:13] <dnivra> Click on the “Add” button. This enables to specify an IP address manually.
  38 [10:13] <dnivra> Enter the value 192.168.1.1 for Address, 255.255.255.0 for Netmask and 192.168.1.255 for Gateway.
  39 [10:14] <dnivra> I'll explain the meaning of the values if we have time at the end of the session-they are not really relevant here.
  40 [10:14] <dnivra> (as long as they work of course :) )
  41 [10:14] <dnivra> Once you have entered the values, click Apply.
  42 [10:15] <dnivra> Repeat the above steps from right clicking on network manager icon to clicking on apply in the second machine as well except using 192.168.1.2 instead of 192.168.1.1.
  43 [10:15] <dnivra> Ensure you use the same name for the network, in case of wireless connections.
  44 [10:16] <dnivra> by now, we have configured the connection.
  45 [10:16] <dnivra> now, plug the lan cable into the ethernet ports of the two computers.
  46 [10:17] <dnivra> and please click on network manager and connect to the network you created by clicking on the name of the network. A notification would be shown soon which would say whether the connection is active or not.
  47 [10:18] <dnivra> Though the connection is active, it needn't be the case that the computers are connected.
  48 [10:18] <dnivra> To test if two computers are indeed connected, we use the command ping.
  49 [10:18] <dnivra> there are two ways you can use ping.
  50 [10:19] <dnivra> 1. Simple Method: run “ping 192.168.1.2” in the terminal of the machine 192.168.1.1.
  51 [10:19] <dnivra> and vice versa too if you want though not required.
  52 [10:19] <dnivra> or do it using the GUI: System -> Administration -> Network Tools -> Ping.
  53 [10:20] <dnivra> Enter the IP address in the box there and click on the button “ping”.
  54 [10:20] <dnivra> enter IP address in the box named "Network address".
  55 [10:20] <dnivra> you can do vice versa too.
  56 [10:21] <dnivra> if you were able to ping successfully, the computers are connected! success! yaay!
  57 [10:22] <dnivra> a successful ping from terminal would have a similar output http://paste.ubuntu.com/559830/.
  58 [10:22] <dnivra> *similar* not same.
  59 [10:22] <dnivra> i'll pause for questions if any :). though I'm guessing steps till now are pretty clear.
  60 [10:24] <dnivra> no questions? alright then moving on to the sharing part.
  61 [10:24] <dnivra> In the server machine, right click the folder/file you want to share and select “Sharing Options”.
  62 [10:24] <dnivra> The folder sharing window opens up.
  63 [10:25] <dnivra> By default, the “Share this folder” option is not selected. Check this option.
  64 [10:26] <dnivra> Now, you can specify a share name or choose to stick to the default name.
  65 [10:26] <dnivra> sometimes samba may complain that 'share name is too long'. just choose a shorter name in that case.
  66 [10:28] <dnivra> the other two options can be left untouched. they are self explanatory in my opinion.
  67 [10:28] <dnivra> but if you do enable them, do so with care :)
  68 [10:29] <dnivra> Click on “Create Share” and your share will be created in the server machine.
  69 [10:29] <dnivra> any questions till this stage?
  70 [10:31] <ClassBot> digbydog asked: The share defaults to the same name as the folder can that be a problem?
  71 [10:31] <dnivra> no there wouldn't be any issues
  72 [10:32] <dnivra> in fact, i choose to stick to the same name as the folder. otherwise I have to remember the mapping-which share name for which folder.
  73 [10:32] <dnivra> hope that answers your question digbydog
  74 [10:32] <dnivra> any more questions before we move on?
  75 [10:33] <dnivra> okay so moving on.
  76 [10:33] <dnivra> Now how to view the shared files.
  77 [10:33] <dnivra> In the client machine, navigate to Places -> Connect To Server.
  78 [10:34] <dnivra> the connect to server box pops up now.
  79 [10:34] <dnivra> There are several ways to connect to the server. This is specified by service type.
  80 [10:35] <dnivra> For our current discussion, select “Windows Share”.
  81 [10:35] <dnivra> note that using this method, you can connect to windows shares from ubuntu and also to samba shares on other ubuntu machines.
  82 [10:36] <dnivra> In server, enter the IP address of server machine.
  83 [10:36] <dnivra> i.e. 192.168.1.1
  84 [10:36] <dnivra> (assuming 192.168.1.1 is your server)
  85 [10:36] <dnivra> You can supply the optional information but not essential-you will be prompted for the required ones later.
  86 [10:37] <dnivra> once you are done entering the information(if you are doing so), click on connect.
  87 [10:38] <dnivra> if you did not specify any specific information, the share list will be retrieved from the server automatically.
  88 [10:38] <dnivra> share list is the list of folders that are currently being shared by the server. you can then select the appropriate share.
  89 [10:39] <dnivra> this is where it helps to have same, or at least similar, share name as the folder.
  90 [10:39] <dnivra> of course, if you have an amazing memory, you can choose any share name :). as long as you will remember it.
  91 [10:40] <dnivra> let us say the shared folder is videos and it's share name is also videos.
  92 [10:40] <dnivra> once you connect to the server, the share names will be displayed and the share video will also be displayed there.
  93 [10:41] <dnivra> (assuming you did everything right :) )
  94 [10:41] <dnivra> if you had specified any information, you would see that you won't be prompted for those if they were right.
  95 [10:42] <dnivra> but, i would suggest provide less details-samba will prompt you for required details.
  96 [10:42] <dnivra> and you'd be prompted to enter them, if you double click the share name.
  97 [10:43] <dnivra> i.e. here 'videos'.
  98 [10:44] <dnivra> for the username and password, you can just enter the username and password of the user who created this share on the server.
  99 [10:44] <dnivra> and leave the workgroup to the default value 'WORKGROUP'.
 100 [10:45] <dnivra> the workgroup concept is same as the workgroup concept in windows. so nothing new there :).
 101 [10:46] <dnivra> once you have entered all details, click on connect.
 102 [10:46] <dnivra> the contents of the share would be displayed to you1
 103 [10:46] <dnivra> (assuming all details are correct)
 104 [10:46] <dnivra> which means you've successfully shared files! yaay!
 105 [10:47] <dnivra> and of course, you can do the same via command line as 'nautilus smb://192.168.1.1'.
 106 [10:47] <dnivra> short, simple and my preferred method :)
 107 [10:48] <dnivra> i guess that pretty much means the sessions. i welcome questions now.
 108 [10:49] <dnivra> we have about ten minutes.
 109 [10:49] <dnivra> meanwhile I shall try retrieving a few interesting links about samba.
 110 [10:50] <dnivra> first and best I'd say https://help.ubuntu.com/community/Samba.
 111 [10:50] <dnivra> It talks about various aspects such as configuring clients, servers, the web interface(SWAT) to configure samba, securing samba, sharing filters, troubleshooting, mounting shares permanently and much more.
 112 [10:50] <dnivra> swat is something you can check out-Samba Web Administration Tool.
 113 [10:51] <ClassBot> There are 10 minutes remaining in the current session.
 114 [10:51] <dnivra> but *before* installing swat, back up the samba configuration file located at /etc/samba/smb.conf
 115 [10:53] <ClassBot> digbydog asked: You used the command line nautilus smb://192.168.1.1. smb does not appear as an option for nautilus. What is happening with that command line?
 116 [10:54] <dnivra> digbydog, smb is not an option true. it is a protocol. it stands for Server Message Block.
 117 [10:54] <dnivra> in fact, you can press Alt+F2 and type in 'smb://192.168.1.1'. it would still retrieve the share.
 118 [10:55] <dnivra> smb://192.168.1.1 is sort of similar to http://www.google.com or http://192.168.1.1
 119 [10:55] <dnivra> bottom line, SMB is a protocol just like HTTP.
 120 [10:56] <ClassBot> There are 5 minutes remaining in the current session.
 121 [10:56] <dnivra> more questions anyone?
 122 [10:56] <dnivra> we got 5 minutes or we could wrap up.
 123 [10:58] <dnivra> Here's how to on mounting windows shares permanently. might come in handy for a few. https://help.ubuntu.com/community/MountWindowsSharesPermanently
 124 [10:59] <dnivra> there are tons of guides out there on how to share stuff using samba.
 125 [11:00] <dnivra> here is one on how to share without need for a password. i don't think it quite works though. you can still try it out even though it may be a bit out of reach. http://www.debuntu.org/guest-file-sharing-with-samba
 126 [11:00] <dnivra> and do remember that the normal unix permissions do apply on samba shares. so if you login as a user who can't create a file, you can't create a file.
 127 [11:00] <dnivra> t#ubuntu is the place for any sort of help on this-surely somebody will help you out there. Thank you for listening patiently!
 128 [11:00] <dnivra> I'm done with my session.
 129 [11:00]  * dnivra bows graciously to the audience. I had a lot of fun!
 130 [11:01] <dnivra> Well see you guys around in #ubuntu. Enjoy rest of User Days!

UserDays/01292011/Networking and sharing files in Ubuntu (last edited 2011-01-29 18:44:35 by ptr)