File Sharing with Gnome

Simple file sharing using samba via the gnome GUI.

This tutorial works for the gnome desktop environment, running ubuntu release jaunty or newer.

Gnome has a built in interface for simple samba configuration. It will not do anything fancy, but can be useful nonetheless.

Some definitions:

  • Gnome: the desktop environment that is the default for ubuntu.
  • SMB: the file and printer sharing protocol used by Windows.
  • Samba: the free software implementation of SMB that is used by linux.
  • Fileserver: this is the computer that we have enabled sharing on.
  • Client: this is another computer that is trying to access the files on the fileserver.

In our example, the fileserver will be named cookiejar and have IP address 192.168.1.2. The client will be named sesamestreet and have IP address 192.168.1.100. The server cookiejar will have a user account cookiemonster. There will be a shared volume on cookiejar named shared which corresponds to a folder named Shared.

Related links:

Create a folder

Create a folder on fileserver cookiejar that will be used to share files

Creating a personal shared folder

  1. Go to the Places menu and select Home Folder
  2. In the file browser, go to the File menu and select Create Folder. This will create a folder named untitled folder that is ready for you to edit the folder name by typing.
  3. Change the folder name to be “Shared”. If the folder name becomes uneditable, hit the F2 key to be able to edit the folder name again.

Creating a shared folder for the entire computer

Sometimes it does not make sense to have the shared folder in your home directory. Users come and go, but you might have a shared folder used by everyone.

In order to create a shared folder outside your home directory, you will need root access.

On the command line, type:

% gksu nautilus

This will open a file browser as user root. Browse to a directory, like /home, and create your shared folder there as in the steps above.

Enable sharing

Set up fileserver cookiejar to share files with other computers

While still in the File Browser, right click on the folder Shared that you created and select Sharing Options from the menu.

There are three options that may be checked:

  1. Share this folder: this enables anyone with a user account on this computer to read the contents of your shared folder. If you have don’t have the proper software installed to share folders, then it will ask you if you want to install it. Say yes.
    • Share name: this option lets you determine what name the folder should be shared as. The default is probably good.
  2. Allow other people to write to this folder: If checked, then anyone who is able to access your shared folder will also be able to create files and delete files.
  3. Guest access: If checked, then no user account or password is needed to access your shared folder.

The access controls for this simple sharing are very crude. Remember: if you share a folder, then everyone with a user account has the ability to read the files (at least).

Create the users

Create user accounts on fileserver cookiejar

Unless you enabled guest access, you need to create a user account for anyone who will be accessing your shared folder. You can allow multiple people to use the same user account if you want: samba file sharing does not know about permissions, so all files created in the shared folder will be owned by ‘nobody’.

Create a user account for accessing our new shared folder:

  1. Select menu item System > Administration > Users and Groups
  2. Click Unlock, type your password and click Authenticate
  3. Click Add User, and fill out the New user account form like so:
    • Username: you can pick anything you want (so long as it is composed of numbers and letters). In this example, we will use cookiemonster.
    • Profile: select unprivileged.
    • Password: choose a password, either by hand or generated, and remember what it is.
    • None of the other options are needed
  4. Click OK to create the user.
  5. Click Close to get out of Users Settings control panel.

So now we have our user account (cookiemonster in our example). Unfortunately, this user account is not yet able to access your shared folder. You need to login with this account at least once before it will work (I think this is a bug).

Open a terminal, and type su cookiemonster (or the name of your newly created user account) and the password. For example:

% su cookiemonster
Password: <cookiemonster's password here>
Added user cookiemonster.

When typing the password, you will not see your keystrokes echo to the terminal. This is a security feature.

If you have the right password, you should see the message “Added user cookiemonster”. Now the user is able to access the shared folder. Exit the user account login by typing exit on the command line.

Connect to the shared folder

Connecting from Gnome

connect to cookiejar from client sesamestreet

There are three different methods of connecting to the fileserver from gnome:

  1. direct url method: Open a filebrowser and type ctrl-L. The location bar will become editable. Enter smb:// and the name or IP address of the fileserver. For example: smb://192.168.1.2/shared or smb://cookiejar/shared. You can leave off the “shared” part of the url if you want.
  2. connect to server method: Select menu item Places > Connect to server…" and fill in these fields:
    • Service type: Windows share
    • Server: 192.168.1.2 or cookiejar.
    • Share: “shared” (or the name you filled in for share name when sharing the folder).
    • Folder: you can leave this blank
    • User Name: unless guest access was enabled, fill in the name of the user account you created above. For example, cookiemonster.
    • Domain Name: you can leave this blank
    • Then click Connect
  3. browse the network method: select the menu item Places > Network. Double click on the computer named cookiejar. Then double click on the volume named shared. If you have not enabled guest access, you will be asked to login. Use the same information as for the previous method.

Connecting from Windows

to be written.

Connecting from Mac

  • Choose the menu item Go > Connect to server…
  • For Server Address, enter smb://192.168.1.2 or smb://cookiejar.

Getting fancier

Changing the smb workgroup

Edit /etc/samba/smb.conf

A word on security

SMB is not secure. As files are copied over the network, or internet, they may be easily intercepted. The default configuration for samba in ubuntu is to enable encrypted passwords. This allows for the authentication, at least, to be negotiated in a somewhat safe manner.