Sharing linux file system from windows requires a package ti be installed in linux known as SAMBA. This guide is for only Red hat / CentOS users for both 32 and 64 bit OS.
First of all you need to install three packages
For 64 bit OS
1. samba-common-3.6.9-151.el6.x86_64
2. samba-winbind-3.6.9-151.el6.x86_64
3. samba-3.6.9-151.el6.x86_64
4. samba-client-3.6.9-151.el6.x86_64
5. samba-winbind-clients-3.6.9-151.el6.x86_64
For 32 bit
1. samba-common-3.6.9-151.el6.i686
2. samba-winbind-3.6.9-151.el6.i686
3. samba-3.6.9-151.el6.i686
4. samba-client-3.6.9-151.i686
5. samba-winbind-clients-3.6.9-151.el6.i686
I have mentioned here a particular version, you can download by searching with keywords like this
32 bit OS
samba-common el6 i686
samba-winbind el6 i686
samba el6 i686
samba-client el6 i686
samba-winbind-clients el6 i686
64 bit OS
samba-common el6 x86_64
samba-winbind el6 x86_64
samba el6 x86_64
samba-client el6 x86_64
samba-winbind-clients el6 x86_64
You can also try this keyword with yum install provided you have good repository update.
After installing samba
Add samba users.
Go to terminal su as root and add type these commands
smbpasswd -a username # Give your own username i.e. oracle or root. -a option add the user to samba user list if they don't exists.
[root@RHEL6 ~]# smbpasswd -a oracle
New SMB password: # provide your new password
Retype new SMB password: # retype your password
open /etc/samba/smb.conf with vim or gedit as root user
Add / Update this lines
workgroup = WORKGROUP # It can be other name than WORKGROUP depends on your WORKGROUP / DOMAIN name of windows OS, keep it same as windows
server string = Samba Server Version %v
netbios name = RHEL6 # This is you Linux hostname, netbios name is identified by windows to show on network browser.
Now you have to add this lines for specific directory you want to share.
Suppose you want to share /usr/share/, add this lines at the bottom of the file.
[share]
path=/usr/share
read only = no
writable = yes
browsable = yes
valid users = subhroneel root oracle these are samba user name you have created just before.
available = yes
Suppose you want to share /var/www/html/, add this lines at the bottom of the file.
[webshare]
path=/var/www/html
read only = no
writable = yes
browsable = yes
valid users = subhroneel root # these are samba user name you have created just before.
available = yes
It's all done.
Just go to your Windows machine and access your linux machie by ip address, (hostname do not work always, depends on firewall settings on both windows and linux). Provide your samba username and password. Just keep in mind that the user with which you are accessing you linuxmachine should be owner of the directory shared.
THERE IS ANOTHER EASY WAY TO GET ACCESS TO HOME DIRECTORY. No need to add share connfiguration in smb.cong
run this SELINUX command as root user
setsebool -P samba_enable_home_dirs=1
After you run this command when you log in with a particular user you will get read/wrtie access to home directory of that user.
First of all you need to install three packages
For 64 bit OS
1. samba-common-3.6.9-151.el6.x86_64
2. samba-winbind-3.6.9-151.el6.x86_64
3. samba-3.6.9-151.el6.x86_64
4. samba-client-3.6.9-151.el6.x86_64
5. samba-winbind-clients-3.6.9-151.el6.x86_64
For 32 bit
1. samba-common-3.6.9-151.el6.i686
2. samba-winbind-3.6.9-151.el6.i686
3. samba-3.6.9-151.el6.i686
4. samba-client-3.6.9-151.i686
5. samba-winbind-clients-3.6.9-151.el6.i686
I have mentioned here a particular version, you can download by searching with keywords like this
32 bit OS
samba-common el6 i686
samba-winbind el6 i686
samba el6 i686
samba-client el6 i686
samba-winbind-clients el6 i686
64 bit OS
samba-common el6 x86_64
samba-winbind el6 x86_64
samba el6 x86_64
samba-client el6 x86_64
samba-winbind-clients el6 x86_64
You can also try this keyword with yum install provided you have good repository update.
After installing samba
Add samba users.
Go to terminal su as root and add type these commands
smbpasswd -a username # Give your own username i.e. oracle or root. -a option add the user to samba user list if they don't exists.
[root@RHEL6 ~]# smbpasswd -a oracle
New SMB password: # provide your new password
Retype new SMB password: # retype your password
open /etc/samba/smb.conf with vim or gedit as root user
Add / Update this lines
workgroup = WORKGROUP # It can be other name than WORKGROUP depends on your WORKGROUP / DOMAIN name of windows OS, keep it same as windows
server string = Samba Server Version %v
netbios name = RHEL6 # This is you Linux hostname, netbios name is identified by windows to show on network browser.
Now you have to add this lines for specific directory you want to share.
Suppose you want to share /usr/share/, add this lines at the bottom of the file.
[share]
path=/usr/share
read only = no
writable = yes
browsable = yes
valid users = subhroneel root oracle these are samba user name you have created just before.
available = yes
Suppose you want to share /var/www/html/, add this lines at the bottom of the file.
[webshare]
path=/var/www/html
read only = no
writable = yes
browsable = yes
valid users = subhroneel root # these are samba user name you have created just before.
available = yes
It's all done.
Just go to your Windows machine and access your linux machie by ip address, (hostname do not work always, depends on firewall settings on both windows and linux). Provide your samba username and password. Just keep in mind that the user with which you are accessing you linuxmachine should be owner of the directory shared.
THERE IS ANOTHER EASY WAY TO GET ACCESS TO HOME DIRECTORY. No need to add share connfiguration in smb.cong
run this SELINUX command as root user
setsebool -P samba_enable_home_dirs=1
After you run this command when you log in with a particular user you will get read/wrtie access to home directory of that user.
No comments:
Post a Comment