venerdì, aprile 24, 2015

Install samba server on Ubuntu and share home directories

If you want to share files between your Ubuntu and Windows computers, your best option is to use Samba file sharing.
In this post I wiil describe the steps to install and configure samba file sharing.

Install Samba


To install, do the following command:
# sudo apt-get install samba smbfs
We’ve got samba installed, but now we’ll need to configure it to make it accessible. Run the following command to open the configuration file, substituting your editor of choice:
# sudo nano /etc/samba/smb.conf
Find this section in the file:
####### Authentication #######

# “security = user” is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba-HOWTO-Collection/ServerType.html
# in the samba-doc package for details.
;  security = user
Uncomment the security line, and add another line to make it look like this:
security = user
username map = /etc/samba/smbusers
This will set Samba to use the smbusers file for looking up the user list.

Create a Samba User

There are two steps to creating a user. First we'll run the smbpasswd utility to create a samba password for the user.
# sudo smbpasswd -a <username>
Next, we'll add that username to the smbusers file.

# sudo nano /etc/samba/smbusers

Add in the following line, substituting the username with the one you want to give access to. The format is .
You can use a different samba user name to map to an ubuntu account, but that’s not really necessary right now.

<username> = “<username>”

Now you can create samba shares and give access to the users that you listed here.

Share Home Directories


To share the home directories, open up smb.conf with the following command:
#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user’s home directory as \\server\username
[homes]
comment = Home Directories
browseable = yes

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only “username” can connect to \\server\username
valid users = %S

# By default, the home directories are exported read-only. Change next
# parameter to ‘yes’ if you want to be able to write to them.
writable = yes
Now you should be able to map a drive on windows using the following share format:
\\ubuntumachine\username

Ref:

Nessun commento :

Posta un commento