File sharing with gnome-user-share

Some months ago I wrote about using OpenSSH in combination with GNOME to share files. I advertised it as an easy method, but easy is relative, and using OpenSSH to do the job is still not easy enough. It’s quite a hassle to create a different user with stripped privileges to create a safety measure. That’s why I continued searching for a better method to share files. I found gnome-user-share, which can be found in Ubuntu’s package repository. To install it, just open Applications → Accessories → Terminal and then enter sudo apt-get install gnome-user-share there.

After it’s installed, you can open System → Preferences → Personal File Sharing to access configuration options. It uses a WebDAV to share the ‘Public’ directory in the user’s home directory over the network. It uses Avahi to publish the WebDAV server to all computers on the local network, so no configuration is necessary to allow other computers to access the server. So all you need to do to access the server is open Places → Network, where it should be visible. Additionally, it can also use ObexFTP to share files over Bluetooth.

However, even though gnome-user-share is really easy, it does come with it’s disadvantages. It doesn’t feature configuration of permissions, so you can’t protect your files. It doesn’t integrate in Nautilus. But most of all, it’s only possible to share the ‘Public’ directory, it’s not possible to share other directories. A feature request to implement this already exists in the GNOME Bugzilla – bug #500738 – but so far it hasn’t been picked up yet by the developers. Once this application is more mature, it should definitely be included in GNOME to make file sharing easy. Right now it’s hard to find as a separate application.

Easy file sharing with OpenSSH and GNOME

In my home I have three computers running Ubuntu connected to a router, which form a network. It’s useful to be able to share files with my brother’s PC, and Ubuntu uses Samba as a solution for file sharing because Samba can easily share files with Microsoft Windows. However, in my experience Samba often doesn’t work as it should. When I want to access a Samba share on a remote PC it often starts whining about permissions and refuses access. I don’t know where to start to figure out a solution for this. And in principle, why should you use Samba which reverse-engineered the Microsoft SMB protocol? Shouldn’t there be a better solution which works flawlessly? I started looking around for other methods for easy file sharing, and I found OpenSSH. Using it is surprisingly easy, and you can share files fast and flawless. So that’s why I’m posting a guide to give easy instructions on how to use OpenSSH in combination with GNOME for file sharing.

Because the username and password of your system are used to log in to a computer with SSH, anyone who will be able to log in will have all the privileges that user has, like becoming root. I chose to create a new user account on my system so that I could use that user instead of my own user to log in with SSH, while also stripping this user of any privileges. Then I changed permissions of my home directory to allow read-only access to Others. This can be done by opening System → Administration → Users and Groups. Enter the details for the account, and then disable all the privileges. Now open your /home directory in the Nautilus file manager. Right click your home directory, go to Properties, go to Permissions and set Folder access for Others to Access files. Of course you should solve this differently if your home directory contains privacy sensitive information. Possibly a better solution would be to keep read access to your home directory disabled, while you use the home directory of the new user for writing files. You also place links (create a link to a directory by right clicking the directory and choosing Make Link) to a few directories inside your home directory which contain the files you want to share and for which you have enabled read access for Others.

To log in to a computer with SSH, you need to install the OpenSSH server package first. You can do this by opening Applications → Accessories → Terminal and then enter sudo apt-get install openssh-server there. Then you need to look up the IP-address of the computer you want to log in to, which you can do by opening System → Administration → Network Tools. In my case, I chose to select the Ethernet Interface (eth0) as the network device here. Then you can see the IPv4 IP address, which is what we need. Now use another computer in your home network, and open Places → Connect to Server… and select SSH as the Service type. In the Server field, fill in the IP address of the other computer. Leave the Port field blank, in the Folder field enter the path to your home directory (e.g. /home/alexander) and in the User name field enter the user name you use to log in to the computer. Enable the option to add a bookmark, and give it a name. The bookmark will appear in the Places menu, and in the Nautilus file manager. Then press Connect. You will then be notified that the identity of the computer you are connecting to is unknown, but you should ignore the message and connect anyway. Now you enter your password for the username you entered previously. You have options to forget or remember the password, I chose to remember the password. Now Nautilus will open and display the home directory of your computer. You can start sharing files now. For me this works a lot better than Samba, even though it’s still not the best solution for simple file sharing. This was merely a quick guide, and more detailed documentation is available here on Ubuntu’s documentation website.

Installing Ubuntu from a USB flash drive, continued

A while ago I posted about installing Ubuntu on USB flash drive so that you no longer need to throw away CD’s. I wrote that the process should be made easier for inexperienced users. When I investigated what options there are for installing other distributions on a USB flash drive, I found an application for Fedora called liveusb-creator. This is exactly what I was looking for. I proposed an idea to copy this application for Ubuntu in Ubuntu Brainstorm, but apparently an application to do this is already being developed for Ubuntu 8.10. It’s still experimental work, but this is good news. Certainly this is essential for netbooks which don’t have a built-in optical drive.

EDIT: a specification for USB installation images has recently been approved for the next release of Ubuntu.

Installing Ubuntu from a USB flash drive

Practically every Linux distribution, including my favorite Ubuntu, can be downloaded as an ISO image. Traditionally these ISO images are then burned to a CD recordable or a DVD recordable. When that is done, you load the CD-R in the optical disc drive of the PC on which you want to install the Linux distribution and you restart the PC. The optical disc drive is then used as a boot device, and the Linux distribution can then be installed. In Ubuntu’s case, the installation is started after Ubuntu itself is started, because Ubuntu is a Live CD in case you download the Desktop CD version.

These times USB flash drives are quite popular, and they have some advantages compared to CD’s and DVD’s. The most important advantage in my opinion is that USB flash drives are reusable while CD and DVD recordables are not. Other advantages are portability, performance, reliability and ruggedness. I often have to throw away CD recordables which contain old versions of Ubuntu, I’d like to avoid wasting CD’s. Fortunately, it’s also possible to use USB flash drives for installing Linux distributions.

I have found instructions on the Internet. Because Ubuntu’s ISO image is supposed to fit on a CD it’s file size is approximately 700 MB, so you need a USB flash drive which has a capacity of at least 1 GB. If you are using Windows, follow these instructions. If you are already using Linux, follow these instructions on the Ubuntu Wiki and use the script. These instructions are very easy to follow. But I’ve experienced that these instructions fail to mention an important step, to be able to use the USB flash drive as a boot device I had to change a setting in the BIOS of all three PC’s on which I have booted from a USB flash drive.

You need to set the USB flash drive as the first hard disk drive which is going to be used as the boot device. By default the USB flash drive is set to be the boot device after the hard disk drive(s), and then it will not work because the PC will boot from the hard disk drive. There are several different BIOS manufacturers and the way to do this is depends on which BIOS is used by the PC. On the PC’s I have tested, I have encountered two different BIOS versions, one computer had an Asus A8N-E motherboard which used a BIOS produced by Phoenix Technologies (Award BIOS), the other two computers used motherboards manufactured by MSI and used a BIOS produced by American Megatrends (AMI BIOS).

To access the BIOS, you need to press the Delete key soon after starting up the PC. In the AwardBIOS you need to go to the “Boot” menu, then choose “Hard disk drives”. Then you should see the name of the USB flash drive below the hard disk drives in a numbered list. You need to place the USB flash drive on the top of the list with the “+” key, and then press F10 to save the change and exit the BIOS. In the AMIBIOS you need to choose “Advanced BIOS Features”, “Boot Sequence”, “Hard Disk Drives”.

After I had followed these steps, everything worked perfectly. Unfortunately, this information isn’t found on Ubuntu’s website, but on other websites. The instructionson the Ubuntu Wiki don’t count, because those are “hidden”, i.e. you won’t find them unless you search for them well, this way the average user will never find them unless they are on the Ubuntu.com website. Notice that when you choose the links “Get Ubuntu” and then “Download Ubuntu” on the website, you will arrive at this page after choosing a download server? Here you can find links to pages explaining how you can verify the MD5 sum and how to burn the ISO image to a CD recordable. Exactly this page should also contain a link to a page explaining how to install Ubuntu from a USB flash drive, instructions for doing so should be made more accessible to users. Even if the instructions I linked to are relatively easy, some people which lack knowledge might be put off by it’s seeming complexity. Perhaps an application with a graphical user interface could be created, which would enable the user to select an ISO image and a USB flash drive, and which would then automatically copy the files to the USB flash drive.