Sunday, June 03, 2012

Setup a remote shared folder and configure SAMBA

Server side:

1
    Edit /etc/exports, add one line to the file for each directory to be exported:
      directory hostname(options) hostname2(options)
            directory is an absolute path to a local directory you wish to export
            hostname is the name or IP address of the client if you wish to restrict access or * if no restrictions
            options: see man exports for all options for example ro, rw...
2
    Force the nfs server daemons to reread /etc/exports: exportfs -ra

Client side

1
    Create a mount point: mkdir /mnt/remotefs
2
    Mount the NFS export: mount -t nfs <server name or ip address>:/exportedDir /mnt/remotefs
3
    Use the remote filesystem as if it were local by accessing /mnt/remotefs: ls /mnt/remotefs

Example:
========
On The server side:

[root@erpdb01 /]# cat /etc/exports
/Test erpmt01(rw,sync,no_subtree_check,no_root_squash)
[root@erpdb01 /]#
[root@erpdb01 Test]# exportfs -ra

> system-config-services mark the service "nfs" to start automatically with the OS.
[root@erpdb01 Test]# service nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
[root@erpdb01 Test]#

On the client side:

[root@erpmt01 /]# mkdir /mnt/remotefs
[root@erpmt01 /]# cd /mnt/remotefs
[root@erpmt01 remotefs]# ls
[root@erpmt01 remotefs]#

[root@erpmt01 /]# mount -t nfs erpdb01:/Test /mnt/remotefs
[root@erpmt01 /]#
[root@erpmt01 /]# cd /mnt/remotefs/
[root@erpmt01 remotefs]# ls
Clone_Files  db
[root@erpmt01 remotefs]#

###################################

Configure SAMBA:
================
- Create the user that will be used to access the files from windows...
system-config-users
username: HR
> system-config-services mark the service "smb" to start automatically with the OS.
> system-config-samba:
Add user:
Unix User: HR
Windows User: HR
password: manhr
Add share:
- Basic
Directory: /Test
Share name: images
select (writable,visible)
- Access
Only allow access to specific users
HR

No comments:

Post a Comment