User Tools

Site Tools


Sharing directory on the network with Ubuntu

So let's start by looking for a shared directory. So, I've used Nautilus to navigate to my home folder (Menu item “Places” → “Home Folder”). I have created a new directory and I have right click on it after. In the menu, I have selected “Share Folder”. You might be prompt to install Samba or NFS for file sharing if those packages have not yet been installed. To share files with Windows, it is recommended to use the Samba service. You will then get a dialog box.

In “Share with”, you should select SMB which stands for the protocol name used by Microsoft for file sharing (recently Microsoft changed the name, but SMB still stick to it…) and also as a shortcut for Samba.
You will get a new window like this:

Basically, you should only need to set a network share name in the field “Name:”, and validate your entry. You might want to have a look at the other options to tune the way your share will be available.

Also, if you have changed the default Windows XP workgroup on your Windows system, it would then be recommended, to click on the “General Windows sharing settings” button and modify the “Domain / Workgroup” field to match the one you specified under Windows.

However, if you just installed Samba during this phase you are not completely done. You should first activate Samba. This is done in the menu “System” → “Administration” → “Services”. There you scroll down and look for the Samba service, and you just have to activate it by checking it. Samba is now running.

Nevertheless, you are still not ready. If you try from Windows to access your Linux box, you will see it, but strangely you cannot connect to it, even though you have entered the correct login and password. This is because Windows XP and Samba are configured by default to send password encrypted over the network (this was not the case with Windows 98 and earlier release!)

On Linux, you need an additional step for each user that needs to be authenticated on the network. This step will simply add a “network user” with a encrypted password in the Samba configuration. You need to go in a terminal (menu “Applications” → “Accessories” → “Terminal”) and there you type the following command where you will replace username by your username (must be a valid Linux login).

$ sudo smbpasswd -a username

This command will probably prompt you for the “sudo” password, and then it will prompt you for the SMB password. Please, set there the password you wish to enter from Windows.

You could add this operation when creating new user, so it would become transparent for you. I do not have right in mind how to proceed, I might update this article soon, when I feel the need for this feature.

Also, if you want to authorise a friend to access a network share but not to have a login possibility on your Linux. You need to create a Linux account for him and disallow login. This feature is hidden inside the “Advanced” tab of the User account creation window (see “System” → “Administration” → “Users and Groups” → “+ Add User”). You need to select “/bin/false” for the Shell, and type “/dev/null” (without the double-quotes of course) for the home directory. In the “User Privileges” tab, deselect everything. Once this user has been created, you can perform the step, mentioned above using smbpasswd command, to create the corresponding network user. In that way, your friend will have no possible login via Gnome or a shell. But can access your shared folders.

foss/ubuntu/wikishelf/smb/nautilus.txt · Last modified: 2015/05/01 23:32 (external edit)