千家信息网

Solaris下tftp配置

发表于:2024-12-01 作者:千家信息网编辑
千家信息网最后更新 2024年12月01日,1. 修改inetd.conf,将tftp前面的注释符号去掉,该行最后一个参数/tftpboot即为默认的工作目录,可按需修改vi /etc/inetd.conf## Copyright 2004 S
千家信息网最后更新 2024年12月01日Solaris下tftp配置

1. 修改inetd.conf,将tftp前面的注释符号去掉,该行最后一个参数/tftpboot即为默认的工作目录,可按需修改

vi /etc/inetd.conf

#

# Copyright 2004 Sun Microsystems, Inc. All rights reserved.

# Use is subject to license terms.

#

#ident "@(#)inetd.conf 1.56 04/10/21 SMI"

#

# Legacy configuration file for inetd(1M). See inetd.conf(4).

#

# This file is no longer directly used to configure inetd.

# The Solaris services which were formerly configured using this file

# are now configured in the Service Management Facility (see smf(5))

# using inetadm(1M).

#

# Any records remaining in this file after installation or upgrade,

# or later created by installing additional software, must be converted

# to smf(5) services and imported into the smf repository using

# inetconv(1M), otherwise the service will not be available. Once

# a service has been converted using inetconv, further changes made to

# its entry here are not reflected in the service.

#

#

# CacheFS daemon. Provided only as a basis for conversion by inetconv(1M).

#

100235/1 tli rpc/ticotsord wait root /usr/lib/fs/cachefs/cachefsd cachefsd

# TFTPD - tftp server (primarily used for booting)

tftp dgram udp6 wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot

_tgw3_52200 stream tcp nowait root /opt/ericsson/bin/emt_tgw_telnetd emt_tgw_telnetd -h -P /opt/ericsson/bin

# IMH service for FM

#

IMH_com_rec stream tcp nowait nmsadm /etc/opt/ericsson/fm_core/startscript/IMH_com_rec IMH_com_rec


2. 把服务添加到svc的控制列表中

inetconv -i /etc/inet/inetd.conf 1>/dev/null 2>&1


3. 创建相关目录

# mkdir /tftfboot ; ln -s /tftpboot/. /tftpboot/tftpboot

# chmod -R 777 /tftpboot

# ls -la /tftpboot

total 4

drwxrwxrwx. 2 root root 21 Oct 11 11:43 .

drwxr-xr-x. 19 root root 4096 Oct 11 11:43 ..

lrwxrwxrwx. 1 root root 11 Oct 11 11:43 tftpboot -> /tftpboot/.

4. 用svcadm命令开启服务

$ svcadm enable svc:/network/tftp/udp6:default


5. 检测服务运行状态:

$ svcs -a |grep tftp

online Jan_11 svc:/network/tftp/udp6:default

$ netstat -a |grep tftp

*.tftp Idle

*.tftp Idle

$ lsof -i:69

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

inetd 2298 root 31u IPv6 0x60091ddbd40 0t0 UDP *:tftp

$


//////////////////////////注意

上传文件时报错: Error code 2: Access violation 是因为系统安全策略原因,需要在tftp工作目录中创建了一个同名文件,并修改文件权限chmod 777

例如需要上传文件名为 testfile.txt,服务端操作步骤如下:

cd /tftpboot

touch testfile.txt

vi testfile.txt ///不需要写任何内容

chmod 777 testfile.txt


另外,因该目录挂在根目录,上传文件前需要注意目录剩余空间,并及时清理不需要的文件,或者更改tftp服务默认的工作目录

0