SAMBA
Samba is an easy way to share files over Linux And Windows environment. Samba is presented by samba.org and is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients.
INSTALLING SAMBA
Lets Update first the repositories.
Open a Terminal and type the following :
alexandria@root# apt-get update
Now install samba
alexandria@root# apt-get install samba
Now lets edit the configuration file of samba, but before that lets backup the initial configuration file.
alexandria@root# cd /etc/samba/
alexandria@root# cp smb.conf backsmb.conf
Setup public folder:
First we will create the configuration for a share folder accessible from everyone without any user need it
alexandria@root# nano smb.conf
Add the following to this file:
# [global] workgroup = Workgroup server string = My Samba Share %v security = user map to guest = bad user dns proxy = no # [ShareFolder] comment = This is a folder accessible from everyone path = /sharefolder browsable = yes guest ok = yes read only = no create mask = 0755
Next we need to create the directory that will host the share folder and change the user permissions
alexandria@root# mkdir /sharefolder
alexandria@root# chown -R nobody:nogroup /sharefolder/
alexandria@root# chmod 755 /sharefolder/
Now lets restart the samba server
alexandria@root# /etc/init.d/samba restart
Normally at that point you should be able to access this share folder from Linux or Windows without any user credentials
NOTE:-
In older versions of samba in order to restart samba server you need to run “sudo /etc/init.d/smbd restart”
CREATING PRIVITE FOLDER ONLY FOR UNIX USERS
Lets first create the a User named smbuser:
alexandria@root# useradd smbuser
lets create a password for smbuser that will be used for accessing the samba share
alexandria@root# smbpasswd -a smbuser
now the directory for that user:
alexandria@root# mkdir /smbuserdir
alexandria@root# chown -R smbuser /smbuserdir/
alexandria@root# chmod 755 /smbuserdir/
edit the samba config again:
alexandria@root# nano /etc/samba/smb.conf
Add the following:
# [smbuserdir] comment = This is a folder accessible from smbuser path = /smbuserdir browsable = yes guest ok = no read only = no create mask = 0755
now restart samba deamon
alexandria@root# /etc/init.d/samba restart
In order to access the share folder you need to use for username: “smbuser” and for password the password you create when you add the user.
All Done!