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 fileservercookiejar
that will be used to share files
Creating a personal shared folder
- Go to the Places menu and select Home Folder
- 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.
- 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 fileservercookiejar
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:
- 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.
- 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.
- 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 fileservercookiejar
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:
- Select menu item System > Administration > Users and Groups
- Click Unlock, type your password and click Authenticate
- 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
- Username: you can pick anything you want (so long as it is composed of numbers and letters). In this example, we will use
- Click OK to create the user.
- 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 tocookiejar
from client sesamestreet
There are three different methods of connecting to the fileserver from gnome:
- direct url method: Open a filebrowser and type
ctrl-L
. The location bar will become editable. Entersmb://
and the name or IP address of the fileserver. For example:smb://192.168.1.2/shared
orsmb://cookiejar/shared
. You can leave off the “shared” part of the url if you want. - 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
orcookiejar
. - 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
- browse the network method: select the menu item Places > Network. Double click on the computer named
cookiejar
. Then double click on the volume namedshared
. 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
orsmb://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.