Wednesday, April 18, 2012

Step by Step NFS Configuration
The Network File System is certainly one of the most widely used network services. Network file system (NFS) is based on the Remote procedure call. It allows the client to auto mount and therefore, transparently access the remote file systems on the network. It is used to share/map disk from one Linux System to other Linux System. NFS was developed to allow the user to access remote directory as a mapped directory. NFS is not a single program. It is a suite of related programs, which work together.
In this document we will export the file system from the (IP address host and mount it on (IP address
(1) Verify NFS daemon Service
Here we assume that the NFS service daemon is already installed on our system, including portmap daemon on which NFS setup depends. One more thing, our system needs to support the NFS file system.For this we need to issue the following command:
$ cat /proc/filesystems
Another way to check if NFS is functioning is to use following “rpcinfo” command.
$ rpcinfo -p
We should get a response/output
(2) (a) Server export file
All NFS server exports need to be defined in /etc/exports file.

Most common exports options:

/home/nfs/,sync) export /home/nfs directory for host with IP with read, write permissions, and synchronized mode
/home/nfs/ (ro,sync) export /home/nfs directory for network netmask with read only permissions and synchronized mode
/home/nfs/ (rw,sync) (ro,sync) export /home/nfs directory for host with IP with read, write permissions, synchronized mode, and also export /home/nfs directory for hosts with IP with read only permissions and synchronized mode
/home/nfs/ (rw,sync,no_root_squash) export /home/nfs directory for host with IP with read, write permissions, synchronized mode and the remote root user will be treated as a root and will be able to change any file and directory.
/home/nfs/ *(ro,sync) export /home/nfs directory for any host with a read only permission and synchronized mode
/home/nfs/ *,sync) export /home/nfs directory for any host within domain with a read only permission and synchronized mode
/home/nfs/ (rw, sync) export /home/nfs directory for hostname with read, write permissions and synchronized mode

(b) Edit exports file
Open up text editor, for example, vi editor and edit /etc/exports file and add line /home/nfs/ *(ro,sync) to export /home/nfs directory for any host with read only permissions.
/home/nfs/ *(ro,sync) to export /home/nfs directory for any host with read only permissions.

/home/nfs/ *(rw,sync)
We needto be sure that the directory you export by NFS exists. You can also create a file inside the /home/nfs directory which will help us troubleshoot once we mount this file system remotely.
$ touch /home/nfs/test_file

(c) Restart NFS daemon
Once we edited /etc/exports file, we need to restart NFS service to apply changes in the /etc/exports file. Depending on our Linux distribution, the restarting of NFS may differ. Debian users:
# /etc/init.d/nfs-kernel-server restart
Redhat users
# /etc/init.d/nfs restart
If you later decide to add more NFS exports to the /etc/exports file, you will need to either restart NFS service or run command exportfs:
# exportfs -ra

3. Mount remote file system on client
First we need to create a mount point:
# mkdir /home/nfs_local
If we are sure that the NFS client and mount point are ready, we can run the mount command to mount exported NFS remote file system:
# mount /home/nfs_local
here we mounted /home/nfs from to local machine.
In case if we need to specify a type of the filesystem we can do this as shown below:
# mount -t nfs /home/nfs_local
We may get error message as shown below:
mount: mount to NFS server failed: timed out (retrying).
This may mean that our server supports higher versions of nfs and therefore we need to pass one extra argument to our nfs client. In this example we use nfs version 3:
# mount -t nfs -o nfsvers=3 /home/nfs_local Author – A.Kishore/Sachin 4
Now we should be able to see that the file system is mounted.
Please Note: The mount command reports that the filesystem is mounted as "read and write", although we can see that it provides a "read only" permission.
4. Configure automount
To make this mount point completely transparent to end users, we can automount the NFS file system every time a user boots a PC, or we can also use PAM modules to mount once a user logs in with a proper username and password. In this situation we need to edit /etc/fstab to mount system automatically during a system boot. We can use vi editor and create new line like this: /home/nfs_local/ nfs defaults 0 0
in /etc/fstab or
# echo " /home/nfs_local/ nfs defaults 0 0" >> /etc/fstab
Restart NFS daemon with following commands:
$ /etc/init.d/nfs restart
$ /etc/init.d/nfslock restart

Tuesday, April 17, 2012

Configure samba server

Configure samba server

In this example we will configure a samba server and will transfer files from client side.For this example we are using two systems one linux server one window clients.

per quest of samba server

A linux server with ip address and hostname Server
A window client with ip address and hostname Client2
Updated /etc/hosts file on linux system
Running portmap and xinetd services
Firewall should be off on server

We have configured all these steps in our pervious article.

necessary configuration for samba server

We suggest you to review that article before start configuration of samba server. Once you have completed the necessary steps follow this guide.

samba rpm is required to configure samba server. check them if not found then install
rpm for samba server

Now check smb, portmap, xinetd service in system service it should be on

Select System service from list

Now restart xinetd and portmap and smb service
service restart
To keep on these services after reboot on then via chkconfig command
After reboot verify their status. It must be in running condition
service status

Create a normal user named vinita

now create /data directory and grant it full permission

open /etc/samba/smb.conf main samba configuration files
vi smb.conf
By default name of workgroup is MYGROUP in smb.conf file. you can change it with desire name
workgroup tag
our task is to share data folder for vinita user so go in the end of file and do editing as shown here in this image
share data folder in smb.conf
save file with :wq and exit

Now add vinita user to samba user
we have made necessary change now on smb service and check it status
service smb status
if you already have on this service then restart it with service smb restart commands.
Client configuration for samba server

Go on windows system and ping samba server, change computer name to client2 and workgroup name to MYGROUP
my computer properties
reboot system after changing workgroup name

After reboot open my network place here you can see samba server [ if not see then click on view workgroup computer in right pane, if still not see then use search button from tool bar and search computer samba server form ip ]
samba server in my network place
First try to login from user nikita she will not successes as nikita have not permission to login
user nikita deny
Now login from user vinita [ give the password which you set with smbpasswd command ]

user vinita

As you can see in image user vinita gets the /data folder which we share from samba server
data folder on widow
Copy some window files in data folder
copy in data folder
Check status on samba server

on samba server you can check runtime status of samba server to check it run smbstatus command
in output you see that one samba shared directory is used on window system