Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts

Friday 20 October 2017

How to configure NTP server and client on Solaris 10 and Solaris 11

As you know NTP ( Network time Protocol) is one of the oldest internet protocol still in use and it allows the synchronization of computer clocks distributing UTC (Coordinated Universal Time) over the network.

NTP Service on Solaris 10 and Solaris 11:

Solaris 10 used the SMF utility (Service Management Facility) and the NTP service is now managed by SMF (Service Management Facility). NTP daemon configured using Service management facility (svc:/network/ntp:default) and a bunch of sample ntp.conf files to quickly configure a machine as a client or as a server. On Solaris 11 only ships with NTP v. 4, the NTP v. 4 service is identified by the name ntp4. You can check the ntp status using below command.

!-[solaris]# svcs status ntp

STATE  STIME   FMRI
online 10:14:23 svc:/network/ntp:default

If you see the above command output it is shown that network time protocol services is enable and online on the server.

Steps for Configuring a NTP client:

Suppose your machine is just a client machine, then you can just take the /etc/inet/ntp.client file and copy it to /etc/inet/ntp.conf.

multicastclient 127.0.0.1

If you see the configuration it's a passive configuration for a Server host which listens for NTP server putting packets on the NTP multicast network, 127.0.0.1. If your machine is on LAN without NTP server then in that case we are not recveied any packet and for this we need to use Public NTP server for host.

In my case, I'm using the Indian pool in.pool.ntp.org and my configuration file contains:

server 2.in.pool.ntp.org
server 1.asia.pool.ntp.org
server 3.asia.pool.ntp.org

Normally NTP requires a poll period to elapse before starting synchronizing your clock. If you want NTP to start immediately, which you most probably will if you're configuring a desktop environment, you can take advantage of iburst keyword, introduced in NTP v. 4: it instructs NTP to start the synchronization almost right away.

server 2.in.pool.ntp.org ibrust
server 1.asia.pool.ntp.org ibrust
server 3.asia.pool.ntp.org ibrust

You must make sure you're configuring NTP implementation corresponding to the syntax you're using.

Setting up the drift file:

The last thing which is remaining for NTP server setup in the client machine is to set up  drift file location. On my machine it is 

driftfile /var/ntp/ntp.drift

After setup the drift file configuration we will start the NTP servivce again 

!-[solaris]# svcadm restart svc:/network/ntp:default
!-[solaris]# svcs status svc:/network/ntp:default
STATE  STIME   FMRI
online 12:20:12 svc:/network/ntp:default 

Once the service is running, you can check which server you're using with ntpq, Please run the below command to check the ntpq.

!-[solaris]# ntpq -p

Setting up an NTP server:

Now in above step you see the NTP service has been started successfully, so now, you'll probably want to setup all of your machines.

If you're in a LAN, you can setup an internal NTP server which will provide data to other clients on your LAN. As before, you can take inspiration from the server configuration file shipped with Solaris 10 or Solaris 11, /etc/inet/ntp.server.

After setting up the drift file and the clients you're going to use, you can examine the other options and fine-tune them at your taste. Let's give a quick look at it.

server 127.127.XType.0

Now you have configured the NTP server properly. Please comment on the post if you have any suggestion.

Tuesday 18 July 2017

Solaris Package administration in Solaris 10 Operating System

In this article, we will provide all the commands with an example which describe as below.

pkginfo- It displays all software package information.
pkgadd- It installs all software packages to the system.
pkgrm- It removes a package from the system.
pkgchk- It checks package installation state.
pkgtrans- It translates packages from one server format to another.

Commands & Syntax for checking a package information:

For checking a packages information on Solaris 10 operating system we will used the "pkginfo" command. You can find the all command and syntax related to "pkginfo" is listed below.

Please use the below command to display information about installed software packages.

!-[solaris]# pkginfo | more

Please use the below command to view additional information.

!-[solaris]# pkginfo -l | more

Please use the below command to view information of a specific package.

!-[solaris]# pkginfo -l SUNWman

Please use the below command to find how many packages are currently installed.

!-[solaris]# pkginfo | wc -l

To list all installed software packages, please use the below command.

!-[solaris]# more /var/sadm/install/contents

These above commands with their syntax are daily used on Solaris 10 platform.

Commands & Syntax for checking a package installation:

For checking an information about packages are installed or not on the server , we need to use "pkgchk"  command. Please find the below example as describe below.

Please use the below command to check the contents & attributes of a currently installed package.

!-[solaris]# pkgchk SUNWpkgs

Please use the below command to list the all files contained in a software package.

!-[solaris]# pkgchk -v SUNWpkgs

Please use the below commands to find if the contents & attributes of a file have changed since it was installed with its software package.

!-[solaris]# pkgchk -p /etc/shadow 

Please use the below commands to list information about selected files that make up a package.

!-[solaris]# pkgchk -l -p /usr/bin/showrev

If the packages is installed already then in that case "pkgchk" command don't show any output that clear meaning is that packages is already installed on the server.

Commands & Syntax for adding a package software:

For adding a packages on the server, we will used the "pkgadd" command. Please find the below commands and their syntax which is daily used on Solaris operating system.

Please use the below command to add a software packages from DVD. For this you need to move on dvd directory where all the packages are listed.

!-[solaris]# pkgadd -d . SUNWpkgs

Using above command you can add the packages from DVD.

Commands & Syntax for removing a package software:

For removing the packages from the server, we will used "pkgrm" command. Please find the below commands and their syntax as listed below.

Please use the below command to remove the software packages.

!-[solaris]# pkgrm SUNWpkgs

Please use the below command to remove a package from the spool directory.

!-[solaris]# pkgrm -s /export/pkg SUNWldam

Commands & Syntax for translating a packages format:

For translating a packages format from one format to another , we will used the "pkgtrans" command for the same.

Please use the below command to translate a package from file system format in /var/tmp to data stream format.

!-[solaris]# pkgtrans /var/tmp /tmp/SUNWpkgs.pkg SUNWpkgs

Please use the below command to create a data streamed package.

!-[solaris]# pkgtrans -s Product /var/tmp/stream.pkg SUNWpkgg SUNWpkgs

NFS mount on Solaris 11 Non-Global zones systems

In this article, we would learn how we mount folder from one Non-Global zone to another zone on Solaris 11 operating system using network file sharing.

For an example, we can use take a two local zone "sunz01" & "sunz02". We will mount one folder named "/export/backup" from "sunz01" local zone to another zone "sunz02" on "/project/export/data" location.

Step by Step method of NFS mount on Solaris 11:
 
➦ In the first step we will create the directory on "sunz02" zone where we want to mount the folder.

sunz02#mkdir /project/export/data
 
➦ In second step, we will make a configuration for this process. So for this work you need to login on global zone with root access and make an entry on the dfstb configuration file.

sun#vi /etc/dfs/dfstab

share -F nfs -o rw=sunz02 /zones/sunz01/root/export

If you see the above entry, we have provided the read/write access to directory on sunz02 server where we mount the folder from sunz01 local zone.
 
➦ In next step you need to login on sunz02 server and mount the shared folder using below command.

sunz02#mount sun:/zones/sunz01/root/export/backup /project/export/data
 
➦ Once you run the above command the folder is mount from one local zone to another zone temporarily. You can go to the directory and verify that the data which is listed on /export/backup folder is show on sunz02 directory.
 
➦ In the last step you need to restart the NFS service on the global zone so the configuration files and other changes makes affect. But these configuration are available until we are not taking reboot of the zone.

If you have any query regarding this topic, please post your comment here, we will get back to you shortly.

Tuesday 11 July 2017

How to install and configure the ftp server in linux system

When you are going through this post, you can learn how to install or configured the file transfer protocol in linux operating system.

Normally, FTP server is used to upload or download the files from server machine to client machine. FTP works on TCP 20/21 protocol, TCP port 20 is used for uploading and TCP 21 port is used for downloading purpose.

Step by step method of FTP server installation and configuration:
 
➦ In the initial step , we will install the all required rpm or packages on the Linux server using "YUM" utility.[root@localhost]# yum  install  vsftpd*

If you have source rpm packages then you can install it. In our case we will install the rpm with yum. Using above command all the ftp packages and their dependency are installed.
 
Once the required packages has been installed successfully on the Linux server, we will start the ftp services on the server.[root@localhost]#service  vsftpd  start

Once the service start successfully we will make permanent it so after reboot of server it would be enable always.
[root@localhost]#chkconfig vsftpd on
 
Now, to check the location of ftp server file which we upload or create after ftp server installation.[root@localhost]#cd /var/ftp/pub[root@localhost]#ls

And check the file which you have created after ftp server installation. If you find your created file here then you can ensure your ftp server has been installed successfully on Linux server.
 
Now for checking the ftp server using login in it.

# ftp  Server IP address  ( In my case server ip is 192.168.1.240)
Name(192.168.1.240:root):anonymous
Passwd   (press enter)   --- by defult anonymous password is blank

ftp>   (It will show you have successfully enter in ftp server)
ftp> ls
pub ( will see this directory in ftp location)
ftp>cd  pub
pub> mkdir  testing
pub> permission denied  (error getting)
 
To give the permission to make a directory in pub ,changes in this file[root@localhost]#vi  /etc/vsftpd/vsftpd.conf

Uncomment all these below lines
anonymous_enable=yes
anon_upload_enable=yes
anon_mkdir_write_enable=yes
save the file
 
Now we will take a restart of the ftp services again. You can follow the step 2 to take a restart of ftp services.
 
In this step we will provide the permission to pub folder so that client user can read/write the file and folder in the default direcoty.[root@localhost]#chmod 777  /var/ftp/pub

In my case I will give the full permission to pub folder. You can set the permission according to your project requirement.
 
If you want to ensure that you are able to created and access the folder or not on ftp server then in this case you need to login again in ftp server.[root@localhost]#ftp  192.168.1.240
Name: anonymous
Passwd (enter)
ftp> Cd  pub
pub>mkdir testing
testing           (directory created)
pub>ls
testing

If you want to check the directory which we created in above text please go to the below location and find it
[root@localhost]#cd  /var/ftp/pub
Pub]#ls
testing

So now you will get the file on the ftp pub folder which you created that means the permission which you provide to the user are working properly.
 
You want only one user is able to login by ftp server and access only one particular folder, also not able to delete the file and folder on ftp server, having a ability of uploading and downloading through ftp server. For this thing we have to change in configuration file and chroot_list, ftpuser file.

First create a user which you want to access for ftp user
[root@localhost]# useradd  -s /sbin/nologin  ttftpuser       (His shell is nologin so other user not login)[root@localhost]#passwd  ttftpuser

Now create a folder in ttftpuser which you want to give access
[root@localhost]#cd  /home/ttftpuser
ttftpuser~]#mkdir  noidaftp
ttftpuser~]#chmod  777  noidaftp

Now go to the file chroot_list, add the user  only which you want to give access.
[root@localhost]#vi  /etc/vsftpd/chroot_list
ttftpuser    (make a entry of user which you want to give access)

Now if you want no other user login in ftp server then entry all those user except chroot_list user in ftpuser file.
[root@localhost]#vi /etc/vsftpd/ftpuser

Promartuser    (these are users on which ftp server is make )
testing

Now go to configuration file and make changes in  file and change all the parameter which is required on the configuration files.
[root@localhost]#vi /etc/vsftpd/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
syslog_enable=NO
dual_log_enable=YES
vsftpd_log_file=/var/log/vsftpd.log
xferlog_file=/var/log/xferlog
xferlog_std_format=YES
ftpd_banner=*************************Welcome to blah FTP service******************
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
listen_port=54321
cmds_allowed=ABOR,ACCT,ALLO,APPE,CDUP,CWD,EPRT,EPSV,FEAT,HELP,LIST,MDTM,MKD,MODE,NLST,NOOP,OPTS,PASS,PASV,PORT,PWD,QUIT,REIN,REST,RETR,RMD,RNFR,RNTO,SITE,SIZE,SMNT,STAT,STOR,STOU,STRU,SYST,TYPE,USER,XCUP,XCWD,XMKD

Save the file for above changes which is in bold text in file and restart the ftp services which is describe in step 2.
[root@localhost]#service vsftpd restart

Now check login on console mode
[root@localhost]#ftp  192.168.1.243 54321

Enter username:ttftpuser
Passwd..enter the passwd
ftp> you have successfully enter
ftp>ls
noidaftp      (folder you have seen)
ftp>put  vsftpd.conf        (it will upload file )
ftp>get  vsftpd.org          (it will download file)

If you want to change the user shell please run the below command method as describe below.
[root@localhost]#usermod  -s  /sbin/nologin  username[root@localhost]#usermod  -s /bin/bash  username

So using above method we can easily installed and configured the ftp server on Linux operating system.

How to Remove or Delete a Non-Global Zone from Solaris Operating system

As you aware that Non-Global zone are hosted on Global zone on Solaris Operating system. You can check the Non-Global zone list using "zoneadm" command. It will show you are running and installed zones on Global zones.
 
Please find the below step by step method to remove of local zone from global zone.

Step by Step Method of removal a Non-Global Zone:

First of all you need to check the Non-Global Zone list to ensure which zone is running on the server.

global# zoneadm list -iv

You will see a display that is similar to the following:

ID  NAME     STATUS       PATH                           BRAND      IP
 0    global       running         /                                   solaris    shared
 1    sunz01       running         /zones/sunz01                solaris    shared
In the above command output you can see the Non-Global Zone "sunz01" is running, which we need to remove or delete from Solaris Server.

Now, we need to shutdown the required zone which we need to delete. We can shutdown the Non-Global zone using below commands.
--------------------------------------------
global#zoneadm -z sunz01 halt
or
global#zoneadm -z sunz01 shutdown
or
global#zlogin sunz01 shutdown
-------------------------------------------
In next step when your Non-Global zone shutdown you need to uninstall the local zone. You can used the below method to uninstall the Non-Global Zone.

global#zoneadm -z sunz01 uninstall

Using above command Non-Global zone "sunz01" has been uninstall successfully.

In the last step you need to remove or delete all dataset and configuration files of Non-Global zone "sunz01" from Global zone.

global#zonecfg -z sunz01 delete

Using above command all the configuration files related to this Non-Global zone has been deleted successfully. Now you can remove the folder related to this zone.

So using above method we can remove or delete the Non-Global zone from global zone or Solaris Operating system. Please let me know if you are facing any issue during using this process.

Friday 7 July 2017

How to configure NTP Server on AIX Operating system

NTP ( Network time Protocol) is one of the oldest internet protocol still in use and it allows the synchronization of computer clocks distributing UTC (Coordinated Universal Time) over the network.

Their are several ways to configure the NTP server in different linux servers but if you are doing configuration on AIX operating system it's seems tricky, So in this post you can aware about the step by step configuration of NTP in AIX.

Step by Step Configuration of NTP Server:

➤ In the initial step we must verify that we have check the available NTP server on AIX server. For this please run the below command.

ibm_aix:/>lssrc -ls xntpd
-----------------------------------------------
 Program name:    /usr/sbin/xntpd
 Version:         3
 Leap indicator:  00 (No leap second today.)
 Sys peer:        ntp.aix.in.com
 Sys stratum:     4
 Sys precision:   -18
 Debug/Tracing:   DISABLED
 Root distance:   0.014709
 Root dispersion: 0.066422
 Reference ID:    192.168.1.22
 Reference time:  dc721077.d3a8e000  Tue, Mar 14 2017  7:47:19.826
 Broadcast delay: 0.003906 (sec)
 Auth delay:      0.000122 (sec)
 System flags:    pll monitor filegen
 System uptime:   19248381 (sec)
 Clock stability: 0.000107 (sec)
 Clock frequency: 0.000000 (sec)
 Peer: ntp.aix.in.com
      flags: (configured)(sys peer)
      stratum:  3, version: 3
      our mode: client, his mode: server
 Peer: ntpuk.aix.in.com
      flags: (configured)(sys peer)
      stratum:  3, version: 3
      our mode: client, his mode: server
Subsystem         Group            PID          Status
xntpd            tcpip            8520514      active
------------------------------------------------------

You can found the above output once you run the above command to check the available NTP server. On my AIX machine if you see the sys peer should show a valid server (ntp.aix.in.com). If the server is not showing any ntp server then we need to correct it by adding a server line into /etc/ntp.conf and will take restart of "xntpd" services.

Note : In this post I will use my dummy NTP name instead of real NTP server because of security reason.

➤ As your NTP server is not configured and it is show "insame" then you need to add manual entry on the NTP configuration file.

ibm_aix:/>vi /etc/ntp.conf

server ntp.aix.in.com
server ntpuk.aix.in.com

Once you added these ntp server entry manually on the configuration file then please take a restart of NTP services.

ibm_aix:/>stopsrc -s xntpd
ibm_aix:/>startsrc -s xntpd

Using above command we can stop and start the "xntpd" service on AIX operating system.

➤ In this step you need to again verify the status of newly added NTP server.

ibm_aix:/>lssrc -ls xntpd

It is taking some time that time because it synchronize process is running. Once the synchronization has been complete and you run the above command you can found the NTP server entry as describe in Step 1.

Step by Step configuration of NTP Client:

➤ On the client machine you need to again verify that you have a server suitable for synchronization or not. For this please run the below command.

ibm_aix:/>ntpdate -d ntp.aix.in.com
-----------------------------------------------------------
14 Mar 08:16:21 ntpdate[64356890]: 3.4y
transmit(192.168.1.22)
receive(192.168.1.22)
transmit(192.168.1.22)
receive(192.168.1.22)
transmit(192.168.1.22)
transmit(192.168.1.22)
transmit(192.168.1.22)
server 192.168.1.22, port 123
stratum 16, precision -6, leap 11, trust 000
refid [63.15.23.11], delay 0.03688, dispersion 24.00334
transmitted 4, in filter 4
reference time:      00000000.00000000  Thu, Feb  7 2036  7:28:16.000
originate timestamp: dc721745.3ff1b000  Tue, Mar 14 2017  8:16:21.249
transmit timestamp:  dc721746.3d08a000  Tue, Mar 14 2017  8:16:22.238
filter delay:  0.03688  0.05624  0.00000  0.00000
               0.00000  0.00000  0.00000  0.00000
filter offset: -0.00081 -0.00750 0.000000 0.000000
               0.000000 0.000000 0.000000 0.000000
delay 0.03688, dispersion 24.00334
offset -0.000812

14 Mar 08:16:23 ntpdate[64356890]: no server suitable for synchronization found
--------------------------------------------------------------------------

If you get the message ," no server suitable for synchronization found", verify xntpd is running on the server also verify that no firewalls are blocking port 123.

➤ If the no server suitable for synchronization then you must specify the xntpd server in /etc/ntp.conf.

ibm_aix:/>vi /etc/ntp.conf

server ntp.aix.in.com

Once you added the NTP server entry on client configuration file then restart the "xntpd" service again.

ibm_aix:/>startsrc -s xntpd

➤ If you want to start the xntpd service on boot time then you need to uncomment the below lines on the configuration file.

ibm_aix:/>vi /etc/rc.tcpip

Unconmment the following line

start /usr/sbin/xntpd "$src-running"

➤ Now verify the NTP server on client machine has been synchronized or not. Please use the same command which we used for checking the status.

ibm_aix:/>lssrsc -ls xntpd

This time on the NTP client machine sys peer should display the IP Address or name of your "xntpd" server. As you know it is taking some time to synchronization so you must wait for time.

Tuesday 4 July 2017

Step by Step Configuration of NTP Server on HP-UX Server

In this post, I would like to explain how we configure the NTP (network time protocol) server on HP-UX operating system server. In my recent post you can found the NTP configuration on Solaris and AIX platform. 

As you know NTP ( Network time Protocol) is one of the oldest internet protocol still in use and it allows the synchronization of computer clocks distributing UTC (Coordinated Universal Time) over the network. It is basaiclly used for time synchronization on Unix servers.

Step by Step Configuration of NTP Server on HP-UX:

➤ In the first step we will check the configuration files of "xntpd" daemon. By default the configuration file for this daemon is "/etc/rc.config.d/netdaemons".

hpx:/> vi /etc/rc.config.d/netdaemons

######################################
# xntp configuration.  See xntpd(1m) #
######################################
#
#  Time synchronization daemon
#
# NTPDATE_SERVER: name of trusted timeserver to synchronize with at boot
# (default is rootserver for diskess clients)
# XNTPD:        Set to 1 to start xntpd (0 to not run xntpd)
# XNTPD_ARGS:  command line arguments for xntpd
#
# Also, see the /etc/ntp.conf and /etc/ntp.keys file for additional
# configuration.
#
export NTPDATE_SERVER=
export XNTPD=0
export XNTPD_ARGS=

This is default configuration entry of this file so for xntpd daemon we need to change the variable which is defined.

export NTPDATE_SERVER='ntp.in.pool.org'
export XNTPD=1
export XNTPD_ARGS=

Note: You must change the NTPDATE server name.

➤ For ntp config please set the correct timezone is setup in /etc/TIMEZONE file.

hpx:/> cat /etc/TIMEZONE
TZ=IST-5:30
export TZ

You can edit the file in vi editor and change the time zone as per your location.

➤ Now, we need to make some changes in NTP configuration files. 

hpx:/> cat /etc/ntp.conf
#Configuration NTP des serveurs
server ntp.in.org.com
server ntpin.in.org.com

You need to replace ntp server name accordingly. In my post I will use dummy server name.

➤ After setting the NTP server name we need to restart the NTP service on HP-UX operating system and verify the ntp configuration.

hpx:/> /sbin/init.d/xntpd restart

hpx:/> ntpq -p

If it is showing you correct ntp server information now. You can match these information with the NTP server name which we use in above step.