{{{#!IRC [10:01] now we welcome dnivra for a class on Networking and sharing files in Ubuntu :) [10:01] thanks pleia2 ! [10:02] Hello everyone. I'm dnivra and welcome to this session on “Networking and Sharing Files in Ubuntu”. [10:02] 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. [10:02] so let's begin. [10:03] Here's a scenario: you want to browse the video collection of your friend and copy few that you like. [10:03] 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. [10:03] 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. [10:04] 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:04] That is there can be issues(say security) with this method. [10:05] I just think going into those details would be rather overwhelming at this stage. So we will just stick to the basics of this. [10:05] For sharing files you will need [10:05] 2 computers :) [10:06] a LAN cable, [10:06] and an internet connection on either computer. [10:06] this computer will act as the server, while other as client. [10:06] oh and you need sudo privilege on the server as well. [10:07] If you have two laptops/desktops with wireless cards, you don't need a LAN cable-you can settle for a wireless connection. [10:07] But, I strongly suggest using LAN owing to higher transfer rates. [10:07] so for starters, let's install samba. [10:07] To do so, please run the command “sudo apt-get install samba” in the terminal. [10:08] Alternatively, you can install samba from Synaptic Package Manager(System -> Administration -> Synaptic Package Manager). [10:08] but i prefer command line, sort of easier and hassle free. [10:08] note that you'll need samba installed on both machines. [10:09] While samba is being installed, let us configure the network and establish a connection. [10:09] To do so, right click on the network manager icon on the top panel and select “Edit Connections”. [10:09] You'll be greeted by the Network Connections window, in which the Wired tab would be selected. [10:10] In the Wired tab, create a new connection by clicking on “Add”. [10:10] I recommend this over using Auto eth0 connection just in case anything gets messed up, you still have Auto eth0. [10:11] For those connecting via wireless, choose the wireless tab and create the connection by clicking on “Add”. [10:11] Those who have a DHCP server running on local network can avoid the following step and hit the “Apply” button. [10:12] If you are unsure, follow the next step(recommended for all). [10:12] On clicking add, a window pops up asking you to specify the properties of the connection. [10:12] (I'm not going to cover security of the connection-it'd require a lot more time.) [10:12] Choose the “IPv4 Settings” tab in the window that just popped up. [10:13] “Method” is set to “Automatic(DHCP)” by default. Choose “Manual” from the box. The “Addresses” box just below will become active. [10:13] Click on the “Add” button. This enables to specify an IP address manually. [10:13] Enter the value 192.168.1.1 for Address, 255.255.255.0 for Netmask and 192.168.1.255 for Gateway. [10:14] I'll explain the meaning of the values if we have time at the end of the session-they are not really relevant here. [10:14] (as long as they work of course :) ) [10:14] Once you have entered the values, click Apply. [10:15] 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. [10:15] Ensure you use the same name for the network, in case of wireless connections. [10:16] by now, we have configured the connection. [10:16] now, plug the lan cable into the ethernet ports of the two computers. [10:17] 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. [10:18] Though the connection is active, it needn't be the case that the computers are connected. [10:18] To test if two computers are indeed connected, we use the command ping. [10:18] there are two ways you can use ping. [10:19] 1. Simple Method: run “ping 192.168.1.2” in the terminal of the machine 192.168.1.1. [10:19] and vice versa too if you want though not required. [10:19] or do it using the GUI: System -> Administration -> Network Tools -> Ping. [10:20] Enter the IP address in the box there and click on the button “ping”. [10:20] enter IP address in the box named "Network address". [10:20] you can do vice versa too. [10:21] if you were able to ping successfully, the computers are connected! success! yaay! [10:22] a successful ping from terminal would have a similar output http://paste.ubuntu.com/559830/. [10:22] *similar* not same. [10:22] i'll pause for questions if any :). though I'm guessing steps till now are pretty clear. [10:24] no questions? alright then moving on to the sharing part. [10:24] In the server machine, right click the folder/file you want to share and select “Sharing Options”. [10:24] The folder sharing window opens up. [10:25] By default, the “Share this folder” option is not selected. Check this option. [10:26] Now, you can specify a share name or choose to stick to the default name. [10:26] sometimes samba may complain that 'share name is too long'. just choose a shorter name in that case. [10:28] the other two options can be left untouched. they are self explanatory in my opinion. [10:28] but if you do enable them, do so with care :) [10:29] Click on “Create Share” and your share will be created in the server machine. [10:29] any questions till this stage? [10:31] digbydog asked: The share defaults to the same name as the folder can that be a problem? [10:31] no there wouldn't be any issues [10:32] 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. [10:32] hope that answers your question digbydog [10:32] any more questions before we move on? [10:33] okay so moving on. [10:33] Now how to view the shared files. [10:33] In the client machine, navigate to Places -> Connect To Server. [10:34] the connect to server box pops up now. [10:34] There are several ways to connect to the server. This is specified by service type. [10:35] For our current discussion, select “Windows Share”. [10:35] note that using this method, you can connect to windows shares from ubuntu and also to samba shares on other ubuntu machines. [10:36] In server, enter the IP address of server machine. [10:36] i.e. 192.168.1.1 [10:36] (assuming 192.168.1.1 is your server) [10:36] You can supply the optional information but not essential-you will be prompted for the required ones later. [10:37] once you are done entering the information(if you are doing so), click on connect. [10:38] if you did not specify any specific information, the share list will be retrieved from the server automatically. [10:38] share list is the list of folders that are currently being shared by the server. you can then select the appropriate share. [10:39] this is where it helps to have same, or at least similar, share name as the folder. [10:39] of course, if you have an amazing memory, you can choose any share name :). as long as you will remember it. [10:40] let us say the shared folder is videos and it's share name is also videos. [10:40] once you connect to the server, the share names will be displayed and the share video will also be displayed there. [10:41] (assuming you did everything right :) ) [10:41] if you had specified any information, you would see that you won't be prompted for those if they were right. [10:42] but, i would suggest provide less details-samba will prompt you for required details. [10:42] and you'd be prompted to enter them, if you double click the share name. [10:43] i.e. here 'videos'. [10:44] for the username and password, you can just enter the username and password of the user who created this share on the server. [10:44] and leave the workgroup to the default value 'WORKGROUP'. [10:45] the workgroup concept is same as the workgroup concept in windows. so nothing new there :). [10:46] once you have entered all details, click on connect. [10:46] the contents of the share would be displayed to you1 [10:46] (assuming all details are correct) [10:46] which means you've successfully shared files! yaay! [10:47] and of course, you can do the same via command line as 'nautilus smb://192.168.1.1'. [10:47] short, simple and my preferred method :) [10:48] i guess that pretty much means the sessions. i welcome questions now. [10:49] we have about ten minutes. [10:49] meanwhile I shall try retrieving a few interesting links about samba. [10:50] first and best I'd say https://help.ubuntu.com/community/Samba. [10:50] 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. [10:50] swat is something you can check out-Samba Web Administration Tool. [10:51] There are 10 minutes remaining in the current session. [10:51] but *before* installing swat, back up the samba configuration file located at /etc/samba/smb.conf [10:53] 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? [10:54] digbydog, smb is not an option true. it is a protocol. it stands for Server Message Block. [10:54] in fact, you can press Alt+F2 and type in 'smb://192.168.1.1'. it would still retrieve the share. [10:55] smb://192.168.1.1 is sort of similar to http://www.google.com or http://192.168.1.1 [10:55] bottom line, SMB is a protocol just like HTTP. [10:56] There are 5 minutes remaining in the current session. [10:56] more questions anyone? [10:56] we got 5 minutes or we could wrap up. [10:58] Here's how to on mounting windows shares permanently. might come in handy for a few. https://help.ubuntu.com/community/MountWindowsSharesPermanently [10:59] there are tons of guides out there on how to share stuff using samba. [11:00] 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 [11:00] 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. [11:00] t#ubuntu is the place for any sort of help on this-surely somebody will help you out there. Thank you for listening patiently! [11:00] I'm done with my session. [11:00] * dnivra bows graciously to the audience. I had a lot of fun! [11:01] Well see you guys around in #ubuntu. Enjoy rest of User Days! }}}