Samba is a suite of utilities that allows your Linux Machines to share files and other resources.
such as printers with Windows Machines.
such as printers with Windows Machines.
Before configuring Samba server in Linux you need to have the following Pre-requests.
1. Linux System with network Configured Here i was configured My IP as 192.168.10.111
2. Windows System with network configured in Same network. here my System is having 192.168.10.108
3.Your Linux System firewall should be disabled.
Main Configuration:
1. Check your linux system wheather the samba package is installed or not with the following
command. [root@localhost ~]# rpm -qa samba*
2. If the packages are not installed in your system, use the following command to install from the internet.
[root@localhost ~]# yum install samba*
Note: Above command is for installing the packages from the internet only. So you should have the internet connection.
3. After installing the Packages
Make sure that xinetd and Portmap service should be run.
For checking those services are running or not, use the following commands.
[root@localhost ~]# /etc/init.d/xinetd status
[root@localhost ~]# /etc/init.d/portmap status
For starting the above service use the following services use the following commands.
[root@localhost ~]# /etc/init.d/xinetd restart
[root@localhost ~]# /etc/init.d/portmap restart
After that Make sure that these services to be run completely.
For that use the following commands.
[root@localhost ~]# chkconfig xinetd on
[root@localhost ~]# chkconfig portmap on
Check the services is running or not. These services should be running condition.
4. Create 2 users in your linux System i.e: vinay and Test
[root@localhost ~]# useradd vinay
[root@localhost ~]# passwd vinay
Changing password for user vinay.
New password:
Retype new password: passwd: all authentication tokens updated successfully.
[root@localhost ~]# useradd Test
[root@localhost ~]# passwd Test
Changing password for user Test.
New password:
Retype new password: passwd: all authentication tokens updated successfully.
5. Now create the share directory. i.e which directory you want to share. Here iam creating directory called 'Sambashare' in the following Path. i.e /opt and give the full Permissions to the directory.
[root@localhost ~]# mkdir /opt/sambashare/
[root@localhost ~]# chmod 777 /opt/sambashare/ (OPTIONAL #chmod -R 1777 /opt/sambshare/ it means only these users RW permission not others users)
[root@localhost ~]# ls -l /opt/
total 360
drwx------. 2 root root 16384 Feb 1 11:01 lost+found
drwxrwxrwx 3 root root 4096 Feb 6 18:12 sambashare
-rwxrwxrwx. 1 root root 344558 Jan 30 15:41 sysstat-10.0.3-1.i586.rpm
6. Now enter the configuration into following file. i.e
/etc/samba/smb.conf
In the above file enter the following configuration. Here iam giving permission to one user only.
Add the configuration at end of the file.
Note: Better to take the backup of the configuration file.
[root@localhost ~]# vi /etc/samba/smb.conf
# My Sharing directory
[data]
comment = personal share
path = /opt/sambashare
public = no
writable = yes
Read only = no
printable = no
browseable = yes
write list = vinay Test
:wq!
Use these to save the configuration file
:wq!
7. Now add the user to the samba user's List
[root@localhost ~]# smbpasswd -a vinay
New SMB password:
Retype new SMB password:
Added user vinay.
[root@localhost ~]#
8. Now we did the all the configurations. so start the samba service and check its status.
[root@localhost ~]# chkconfig smb on
[root@localhost ~]# /etc/init.d/smb restart
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]
[root@localhost ~]# /etc/init.d/smb status
smbd (pid 3686) is running...
Client side configuration for Samba server.
1. Check from your windows System to samba server whether Ping command is working or not.
Start--> run--> cmd --> Ping 192.168.10.111
If you are getting ping with proper reply then your server is working fine or else check the network connectivity and Linux System firewall.
2. Now access your samba server in the following way.
Start --> Run --> \\192.168.10.111 -->Press enter.
(Here IP address is your samba server IP address)
3. It is asking for samba user's username and password.
4. This is your samba server Main Screen.
5. Now you can Copy or Paste your data.
Read only permission so create sharing folder and gave read only permission on file.
How do I set permissions to Samba shares?
Samba Basic permissions are as follows (configuration file is smb.conf [/etc/samba/smb.conf]):
read only: This parameter controls whether an user has the ability to create or modify files within a share. This is default.
guest ok: Uf this parameter is set to yes, the users will have access to the share without having to enter a password. This can pose security risk.
writeable: Specifies users should have write access to the share. You can create the share called helpfiles with read only permission.
[helpfiles]
path = /usr/share/docs
read only = Yes
You can create the share called salesdoc with write permission
[salesdoc]
path = /home/shared/sales
writeable = Yes
You can also create a list of users to give write access to the share with write list option.
For example allow rocky and tony to write to the share called sales:
[salesdoc]
path = /home/shared/sales
write list = rocky tony
You can use following options
read list: This option accepts a list of usernames or a group as its value. Users will be given read-only access to the share.
valid users: You can make a share available to specific users. Usernames or group names can be passed on as its value.
invalid users: Users or groups listed will be denied access to this share.
Samba mask permission It is also possible to specify samba default file creation permission using mask.
create mask: This option is set using an octal value when setting permissions for files.
directory mask: Directories must have the execute bit for proper access. Default parameter is 0755.
.
[salesdoc]
path = /home/shared/sales
write list = rocky sys
create mask = 0775
[root@oracle home]# smbstatus
Samba version 3.0.33-3.7.el5
PID Username Group Machine
-------------------------------------------------------------------
4614 almondz almondz hp2210-pc (192.168.11.99)
4608 Test Test nishank (172.16.10.15)
4611 almondz almondz nakulsharma (192.168.21.21)
4418 almondz almondz almo (192.168.21.137)
Service pid machine Connected at
-------------------------------------------------------
IPC$ 4418 almo Sun Mar 11 05:00:22 2012
almondz 4608 nishank Sun Mar 11 05:14:48 2012
data 4418 almo Sun Mar 11 05:00:24 2012
IPC$ 4611 nakulsharma Sun Mar 11 05:15:01 2012
IPC$ 4614 hp2210-pc Sun Mar 11 05:16:18 2012
IPC$ 4608 nishank Sun Mar 11 05:14:05 2012
No locked files
=================================================================
RHEL 6.1
remove rpm -e samba*
yum install samba*
/etc/samba/smb.conf
-------smb.conf
hosts allow =
127. 192.168.12. 192.168.56. 10.128. //uncommented this line and add ip series
[tptrc-01]
comment = personal share
path = /home/tptrc/tptrc-01
writable = yes
browseable = yes
write list = tptrc-01
valid users = tptrc
----- Hide directory directory
[tptrc]
comment = personal share
path = /home/tptrc
writable = no
browseable = no
comment = personal share
path = /home/tptrc/tptrc-01
writable = yes
browseable = yes
write list = tptrc-01
valid users = tptrc
----- Hide directory directory
[tptrc]
comment = personal share
path = /home/tptrc
writable = no
browseable = no
useradd share
mkdir /home/share/tptr-04 -p
chown root:share -R tptr-04
chmod -R 775 tptr-04
chkconfig --levels 235 smb on
/etc/init.d/smb restart
smbpasswd -a share
password : xxxxx
Enjoy............?
No comments:
Post a Comment