Monday, July 21, 2014

How hard link differ from symlinks in Linux or Unix

Symbolic Link:
Symbolic Links also known as symlinks or soft links. It is a special file that points to another file
When you create a new file, an unused inode on the file system is allocated to it, Every file on a file system has an index node

Symbolic links cross the filesystem 
Symbolic links can link directories.
  
Hard Link:
A hard link allows you to set an additional name pointing to the same inode number from somewhere else on the same file system. 

Hard links cannot cross the filesystem
Hard links cannot link directories. 

You can create the Soft Link by In command with -s option 
Example:
Softlink
You can create the Hard Link by In  command 
Example:
Hard Link
  •  File original and hardlink have the same Inode (8520074)  because there is only one file if you remove one file Data still remain in the other file but link count reduces from 2 to 1.
  •  Symbolic link has different inode number because it is a different file.
  •  Original file permission (rw-r--r--) is applicable, permission shown on symlink (lrwxrwxrwx) are meaningless
  • If you remove Original file, then symlink point to missing files
Symlink Missing






Saturday, September 14, 2013

How to install & configure TFTP server



Trivial File Transfer Protocol (TFTP) is a file transfer protocol. In this article we are going to install tftp server but before starting the installation let’s see some basic features of TFTP

Features:

  • The tftp server serves files using the trivial file transfer protocol
  • The tftp protocol is often used to boot diskless workstations download configuration files to network-aware printers, and to start the installation process for some operating systems.
  • It's useful to backup and restore router's configuration or upgrade IOS.
  • It’s managed via: 'XINETD'
  • It’s fast, UDP-based file transfers
  • It’s unreliable, but in a LAN-connected environment, it is rather reliable


Now let’s install tftp-server package



[root@localhost psandeep]# yum install  tftp-server.i686
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tftp-server.i686 0:0.49-5.1.el6 will be installed
--> Processing Dependency: xinetd for package: tftp-server-0.49-5.1.el6.i686
--> Running transaction check
---> Package xinetd.i686 2:2.3.14-31.el6 will be installed
--> Finished Dependency Resolution


Dependencies Resolved


=============================================================================================================================
Package                    Arch                Version                          Repository                 Size
=============================================================================================================================
Installing:
tftp-server                i686                0.49-5.1.el6                     local.repo                 38 k
Installing for dependencies:
xinetd                     i686                2:2.3.14-31.el6                  local.repo                121 k


Transaction Summary
=============================================================================================================================
Install    2 Package(s)


Total download size: 159 k
Installed size: 311 k
Is this ok [y/N]: y
Downloading Packages:
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                     9.1 MB/s | 159 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing : 2:xinetd-2.3.14-31.el6.i686                                                                            1/2
 Installing : tftp-server-0.49-5.1.el6.i686                                                                          2/2
duration: 393(ms)
Installed products updated.


Installed:
 tftp-server.i686 0:0.49-5.1.el6                                                                                       


Dependency Installed:
 xinetd.i686 2:2.3.14-31.el6                                                                                           


Complete!
We have installed tftp-server package now we need to find the configuration file location so let’s run the rpm query command to verify the tftp-server files

  • '/var/lib/tftpboot' - It’s directory where TFTPD-served content lives
  • '/etc/xinetd.d/tftp' - it’s managed & controlled by  XINETD, config file - enable/disable TFTPD here
  • '/usr/sbin/in.tftpd' - It’s tftp server binary (daemon) - and invoked by XINETD when necessary

[root@localhost psandeep]# rpm -ql tftp-server
/etc/xinetd.d/tftp
/usr/sbin/in.tftpd
/usr/share/doc/tftp-server-0.49
/usr/share/doc/tftp-server-0.49/CHANGES
/usr/share/doc/tftp-server-0.49/README
/usr/share/doc/tftp-server-0.49/README.security
/usr/share/doc/tftp-server-0.49/README.security.tftpboot
/usr/share/man/man8/in.tftpd.8.gz
/usr/share/man/man8/tftpd.8.gz
/var/lib/tftpboot
Let’s enable the TFTP server go to /etc/xinetd.d/tftp and set disable option to “no”  

#vi /etc/xinetd.d/tftp
# default: off


service tftp
{
    socket_type          = dgram
    protocol             = udp
    wait                 = yes
    user                 = root
    server               = /usr/sbin/in.tftpd
    server_args          = -s /var/lib/tftpboot
    disable              = no
    per_source           = 11
    cps                  = 100 2
    flags                = IPv4
}
Note : If you modify your daemon configuration file remember that the changes won't take effect till you restart the xinetd service

Now let’s see whether xinetd service is enable or not at runlevel 3 & 5

[root@localhost psandeep]# chkconfig --list xinetd
xinetd     0:off    1:off    2:off    3:on    4:on    5:on    6:off
Let’s see the xinetd service status

[root@localhost psandeep]# service xinetd status
xinetd is stopped
Let’s start the xinetd service & ensure that: 'UDP:69' is listening and controlled by: 'xinetd'


[root@localhost psandeep]# service xinetd start
Starting xinetd:                                        [  OK  ]
[root@localhost psandeep]#
[root@localhost psandeep]# netstat -nulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address            Foreign Address          State    PID/Program name   
udp     0   0 0.0.0.0:5353             0.0.0.0:*                            1403/avahi-daemon:  
udp     0   0 0.0.0.0:68               0.0.0.0:*                            2343/dhclient  
udp     0   0 0.0.0.0:69               0.0.0.0:*                            3190/xinetd    
udp     0   0 0.0.0.0:46029            0.0.0.0:*                            1403/avahi-daemon:  

When xinetd receive the connection request for tftp then it start the TFTP server binary “/usr/sbin/in.tftpd” and then it will show in the process table


Let’s install the tftp client


[root@localhost psandeep]# tftp -v
bash: tftp: command not found
[root@localhost psandeep]#
[root@localhost psandeep]#
[root@localhost psandeep]# yum install tftp
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tftp.i686 0:0.49-5.1.el6 will be installed
--> Finished Dependency Resolution


Dependencies Resolved


============================================================================================================================
Package               Arch                  Version                          Repository                   Size
============================================================================================================================
Installing:
tftp                  i686                  0.49-5.1.el6                     local.repo                   31 k


Transaction Summary
============================================================================================================================
Install    1 Package(s)


Total download size: 31 k
Installed size: 42 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing : tftp-0.49-5.1.el6.i686                                                                                1/1
duration: 85(ms)
Installed products updated.


Installed:
 tftp.i686 0:0.49-5.1.el6                                                                                             


Complete!

TFTP client is both: interactive and noninteractive Let’s test it


[root@localhost ~]# tftp -v 10.211.55.5 -c get anaconda-ks.cfg
Connected to 10.211.55.5 (10.211.55.5), port 69
getting from 10.211.55.5:anaconda-ks.cfg to anaconda-ks.cfg [netascii]
Received 2032 bytes in 0.2 seconds [77825 bit/s]
[root@localhost ~]# ls
anaconda-ks.cfg  imp       install.log.syslog  powertop-2.3.tar.gz
groups.xml    install.log  powertop-2.3     rpmforge-release-0.5.3-1.el6.rf.i686.rpm
[root@localhost ~]# ps auxww |grep tftp
root   3228  0.0  0.0   4588  1148 pts/0 S+   16:55   0:00 tftp -v 0
root   3673  0.0  0.0   2452   712 ?     Ss   17:56   0:00 in.tftpd -s /var/lib/tftpboot
root   3679  0.0  0.0   4328   732 pts/1 S+   17:57   0:00 grep tftp


[root@localhost ~]# tftp -v 10.211.55.5
Connected to 10.211.55.5 (10.211.55.5), port 69
tftp> help
tftp-hpa 0.49
Commands may be abbreviated.  Commands are:


connect     connect to remote tftp
mode    set file transfer mode
put send file
get receive file
quit    exit tftp
verbose     toggle verbose mode
trace   toggle packet tracing
literal     toggle literal mode, ignore ':' in file name
status show current status
binary set mode to octet
ascii   set mode to netascii
rexmt   set per-packet transmission timeout
timeout     set total retransmission timeout
?   print help information
help    print help information
tftp>

Related Posts Plugin for WordPress, Blogger...

 
Follow my blog with Bloglovin UA-41829888-1