How to Enable Samba Share Directory Set Boolean Variable and Samba Password

If we share there directory then only in the client system they can access the directory. Boolean variable is used to enable the home directory for share position. Samba password is used to perform the authentication operation from client system if we did not specify the password then any one can access the share directory. If we give password then only specified user only the can accesses the files.
First list out /common directory properties
[root@rhel5 ~]# ls -dZ /common/
drwxr-xr-x root root root:object_r:root_t /common/
/common directory mention as object_r:root_t so change it as samba_share_t using option –r –t in chcon linux command
Change the common directory as share using chchon Linux command
[root@rhel5 ~]# chcon -R -t samba_share_t /common
[root@rhel5 ~]# ls -dZ /common/
drwxr-xr-x root root root:object_r:samba_share_t /common/
Then finally check there common directory is it there home directory for samba share is on position.

Set the Boolean samba_enable_home_dirs as one first list out and check there situation
[root@rhel5 ~]# getsebool -a | grep samba
samba_domain_controller --> off
samba_enable_home_dirs --> off
samba_export_all_ro --> off
samba_export_all_rw --> off
samba_share_nfs --> off
use_samba_home_dirs --> off

now it is off stage so change it on stage.
Using setsebool Linux command change there zero to one.
[root@rhel5 ~]# setsebool -P samba_enable_home_dirs=1
Verify is it changes successfully or not [samba_enable_home_dirs --> on]
[root@rhel5 ~]# getsebool -a | grep samba
samba_domain_controller --> off
samba_enable_home_dirs --> on
samba_export_all_ro --> off
samba_export_all_rw --> off
samba_share_nfs --> off
use_samba_home_dirs --> off

Set the samba password using smbpasswd Linux command
Set the samba password using smbpasswd Linux command –a option. Then restart there service.
[root@rhel5 ~]# smbpasswd -a ajay
New SMB password:
Retype new SMB password:
Added user ajay.
[root@rhel5 ~]# service smb restart
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
Then check is it working or not using smbclinet Linux command option -U
[root@rhel5 ~]# smbclient //172.24.0.18/common -U ajay
Password:
Domain=[RHEL5] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]

Related post