If you have a multiple Operating Systems running in one network and you want to share files from linux to windows or vice versa, you have to install Samba under linux in order for you to create a peer to peer connection between them. To do so, following these instructions:
Install Samba on your linux maching by pasting the following command in your terminal:
sudo apt-get install samba
Configuring Samba:
1. Stop Samba first…
sudo /etc/init.d/samba stop
2. Open Samba config:
sudo /etc/init.d/samba stop
3. Replace all the contents with the following:
[DDET click to copy the code]
[global]
; General server settings
netbios name = your_netbios_name
server string =
workgroup = YOUR_WORKGROUP
announce version = 5.0
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192
passdb backend = tdbsam
security = user
null passwords = true
username map = /etc/samba/smbusers
name resolve order = hosts wins bcast
wins support = no
printing = CUPS
printcap name = CUPS
syslog = 1
syslog only = yes
; NOTE: If you need access to the user home directories uncomment the
; lines below and adjust the settings to your hearts content.
;[homes]
;valid users = %S
;create mode = 0600
;directory mode = 0755
;browseable = no
;read only = no
;veto files = /*.{*}/.*/mail/bin/
; NOTE: Only needed if you run samba as a primary domain controller.
; Not needed as this config doesn't cover that matter.
;[netlogon]
;path = /var/lib/samba/netlogon
;admin users = Administrator
;valid users = %U
;read only = no
; NOTE: Again - only needed if you're running a primary domain controller.
;[Profiles]
;path = /var/lib/samba/profiles
;valid users = %U
;create mode = 0600
;directory mode = 0700
;writeable = yes
;browseable = no
; NOTE: Inside this place you may build a printer driver repository for
; Windows - I'll cover this topic in another HOWTO.
[print$]
path = /var/lib/samba/printers
browseable = yes
guest ok = yes
read only = yes
write list = root
create mask = 0664
directory mask = 0775
[printers]
path = /tmp
printable = yes
guest ok = yes
browseable = no
; Uncomment if you need to share your CD-/DVD-ROM Drive
;[DVD-ROM Drive]
;path = /media/cdrom
;browseable = yes
;read only = yes
;guest ok = yes
[MyFiles]
path = /home/samba/
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
force user = your_username
force group = your_username
[/DDET]
Remember to replace the all those written in BOLD.
- netbios name = you can use any betbios name here but to avoid confusion, it’s better to choose the same name you configured upon installation.
- WORKGROUP = replace this with your windows machine’s workgroup (something like MSHOME or WORKGROUP).
- path = the path of the folder you want to share
If you want to make a folder that you want to share, type the following command in the terminal:
sudo mkdir /home/samba
The above code will make a directory in your home folder named ‘samba’. Because we are going to share it with other users (windows and linux), make sure to change its permission to writeable:
sudo chmod 0777 /home/samba
4. force user and force group = this should be your username.
Editing the Samba config is now done. Make sure to save it before closing.
Now you have to start samba again:
sudo /etc/init.d/samba start
Time to add users:
sudo useradd -s /bin/true desired_name
sudo smbpasswd -L -a desired_name
sudo smbpasswd -L -e desired_name
Replace desired_name with your choosen username.
*first command will add another user
*second will set a password for that user
*third will enabled the newly created user
*Note that if you want to add your own username, you just have to type the second and third command.
Everything should be ok now.
To the folder you share in Windows:
- Right click my computer
- Select map network drive
- Type in the \\ip of your linux\MyFiles
ex: \\192.168.0.123\MyFiles
4. Enter username and password.
Done
*source: UbuntuForums