Sharing files with Windows is done with Samba.
On ubunutu, run the following command to install:
sudo apt-get install samba
In order to share user home directories, ensure that /etc/samba/smb.conf
contains the following:
[global] workgroup = MSHOME server string = %h server (Samba, Ubuntu) [homes] comment = Home Directories browseable = no read only = no create mask = 0640 directory mask = 0750
- workgroup – must match that of the Windows hosts. MSHOME if the default workgroup for Windows
- [homes] – an automatic share that is available for user accounts
- browseable – disable the automatic appearance of shares on graphical interfaces, such as windows explorer. Users must explicitly ask for a share (ie. they must know it exists)
- read only – Allow users to write to their home directories
- create mask – Create new files with read/write user, and read group permissions
- directory mask – Create new directories with read/write/execute user and read/execute group permissions
An important part of setting up a samba password is creating user accounts and setting passwords. Samba uses its own password mechanism, smbpasswd
.
Use smbpassword
to provide samba-specific user passwords (-a
), and enable user accounts (-e
) for the users of the samba share:
sudo smbpasswd -a <username> <enter password> sudo smbpasswd -e <username>
Once configuration settings and passwords have been set, run the following command to restart the samba server:
sudo service smbd restart
Users can now access their home directories via a samba share. On windows, open windows explorer and navigate to \\<hostname>\\<username>
. Enter the required username and password when prompted, and user files will be shown!
In order to share specific directories with samba, add the following settings to /etc/samba/smb.conf
:
[privateshare] comment = Private Share path = /media/private browsable = yes read only = no create mask = 0640 directory mask = 0750
After restarting the samba service, the folder /media/private
can be navigated on a windows host via the path \\<hostname>\\privateshare
.
https://help.ubuntu.com/community/Samba/SambaServerGuide#Samba_Server_Configuration_in_terminal