Linux: Setting up tftp server

Configuring tftpd in linux is really a pain in my neck…lol…

Thanks Andrey for helping me to rectify the problem remotely.

The main problem with my linux configuration was the credential denied my router from executing commands to linux tftpd.

Understanding chmod

change mode is the command that change the rights of user, group and/or other.

The binary is like a three buttoned dip switch:

Execute = 001 = 1 in decimal

write = 010 = 2 in decimal

read = 100 = 4 in decimal

The combinations:

no write, no read and no execute = 000 = 0

read, no write and no execute = 100 = 4

read, write and no execute = 100 + 010 + 000 = 110 = 6

read, write and execute = 100 + 010 + 001 = 111 = 7

no read, no write, execute = 001 = 1

no read, write and execute = 000 + 010 + 001 = 011 = 3

read, no write and execute = 100 + 000 + 001 = 101 = 5

chmod options

Based on the combinations above, interpret the meaning of chmod options

where r = read, w = write and x = execute files and/or search directories

Example 1: chmod 755

Means: User rwx, group and other rx

[root@cyruslab /]# ls -l /usr/sbin/in.tftpd
-rwxr-xr-x 1 root root 32688 Jan  3 23:01 /usr/sbin/in.tftpd

Example 2: chmod 777

Means: user, group and other rwx

Example 3: chmod 666

Means: user, group and other rw

chmod option representation

Example: chmod 777

chmod user group other

Modify tftp configuration

Login as root. Then type gedit /etc/xinetd.d/tftp. Default is disable = yes, change to no and save the configuration.

For server_args I have changed to server_args = -s /tftpboot, I have made a directory in root “/” using mkdir /tftpboot. Note in this configuration file the user is root. After the configuration was saved, restart the service:

service xinetd restart

tftp depends on xinetd, however tftp can run as standalone.

Verify the service by using:

[root@cyruslab ~]# chkconfig –list tftp
tftp               on

From the Linux window, go to System > Administration > Firewall, turn on the tftp as shown in this screenshot.

 

There's a cli for iptables which is very complicated...lol

 

Make tftp ready to be used by external host

[root@cyruslab ~]# touch /tftpboot
[root@cyruslab ~]# chmod 777 /tftpboot

Cisco router is not a root user, it belongs to other category which is the last digit, so these combinations can be used:

1. chmod 757 /tftpboot

2. chmod 707 /tftpboot

Test with router

2651-1#copy run tftp
Address or name of remote host []? 192.168.1.107
Destination filename [2651-1-confg]?
!!
2103 bytes copied in 2.275 secs (924 bytes/sec)

[root@cyruslab ~]# cd /tftpboot
[root@cyruslab tftpboot]# ls
2651-1-confg  cisco
[root@cyruslab tftpboot]#

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s