What is 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 :
sudo apt-get update
now install samba
sudo apt-get install samba
now lets edit the configuration file of samba, but before that lets backup the initial configuration file.
cd /etc/samba/
sudo mv 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
sudo nano smb.conf
for that 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
[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
sudo mkdir /sharefolder
sudo chown -R nobody:nogroup /sharefolder/
sudo chmod 755 /sharefolder/
now lets restart the samba server
sudo /etc/init.d/smbd restart
Normally at that point you should be able to access this share folder from Linux or Windows without any user credentials
Setup Private Folder:
Next lets create a private folder only for Unix users
lets first create the a user named smbuser:
sudo useradd smbuser
lets create a password for smbuser that will be used for accessing the samba share
sudo smbpasswd -a smbuser
now the directory for that user:
sudo mkdir /smbuserdir
sudo chown -R smbuser /smbuserdir/
sudo chmod 755 /smbuserdir/
edit the samba config again:
sudo nano /etc/samba/smb.conf
add the following:
#
[smbuserdir]
comment = This is a folder accessible from smbuser
comment = This is a folder accessible from smbuser
path = /smbuserdir
browsable = yes
guest ok = no
read only = no
create mask = 0755
browsable = yes
guest ok = no
read only = no
create mask = 0755
now restart samba deamon
sudo /etc/init.d/smbd 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.
Have Fun!
No comments:
Post a Comment