wlan密码配置及DHCP服务开启
可以将WIFI启动命令写进/etc/init.d/rcS,启动时自动连接WIFI
如果vi /etc/init.d/rcS 修改,出现readOnly 现象,则使用 mount -o remount, rw / 命令。 ifconfig eth0 down
sleep 2 #这个延时经验证是需要的,要等到wifi的驱动模块加载完成才能进行下面的配置指令
ifconfig wlan0 up #打开wlan0 sleep 1
wlan.shJSJEMLabjsjemlab #输入wifi的账号密码 sleep 1
udhcpc -i wlan0 #使用自动分配IP
简单的脚本编写
1.创建一个脚本文件
vi ./wifi_conf
2.添加权限
chmod +x <文件位置>
3.运行脚本文件
./xxx
ftp服务器搭建
一>编译vsftpd程序
1. 获得源码包:vsftpd-2.1.2.tar.gz(位置:光盘资料/源码包/其他软件源码) 2. 解压,进入源码目录:
tar xzvf vsftpd-2.1.2.tar.gz cd vsftpd-2.1.2
3. 修改Makefile,指定交叉编译器: CC = arm-linux-gcc 4. #make
编译时会出现错误,跟libcap.so有关 修改vsf_findlibs.sh: 45-53行注释掉:
Look for libcap (capabilities)
#if locate_library /lib/libcap.so.1; then #echo \
#elif locate_library /lib/libcap.so.2; then #echo \#else
#locate_library /usr/lib/libcap.so && echo \#locate_library /lib/libcap.so && echo \#fi
#make
生成vsftpd可执行程序,放到根文件系统/usr/sbin目录下
二>修改配置文件vsftpd.conf
需要用到哪一项,就把这一项前面的注释‘#’去掉,这里给出我的配置: anonymous_enable=NO no_anon_password=YES local_enable=YES write_enable=YES local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES anon_other_write_enable=YES dirmessage_enable=YES xferlog_enable=YES
connect_from_port_20=YES chown_uploads=YES
xferlog_file=/var/log/vsftpd.log xferlog_std_format=YES async_abor_enable=YES ascii_upload_enable=YES ascii_download_enable=YES
ftpd_banner=Welcome to blah FTP service. ls_recurse_enable=YES listen=YES
listen_port=21
把修改后的vsftpd.conf文件放到根文件系统的/etc/vsftpd目录下,否则运行里会出错:500 OOPS vsftpd: cannot open config
三>创建ftp目录
1. 建立FTP目录: mkdir -p /var/ftp/pub 3
因为ftp目录不能开启所有权限,所以建一个pub目录加上所有权限,用来传输文件 mkdir -p /usr/share/empty 程序运行所用到的目录 2. 改变目录权限
chown root:root /var/ftp chmod 755 /var/ftp cd /var/ftp
chmod 777 pub
四>在开发板上运行vsftpd
把制作好的文件系统下载到开发板上,在后台运行程序: # vsftpd /etc/vsftpd/vsftpd.conf&
可用的文档:
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file # loosens things up a bit, to make the ftp daemon more usable. # Please see vsftpd.conf.5 for all compiled in defaults. #
# READ THIS: This example file is NOT an exhaustive list of vsftpd options. # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's # capabilities. #
# Allow anonymous FTP? (Beware - allowed by default if you comment this out). anonymous_enable=NO no_anon_password=YES #
# Uncomment this to allow local users to log in. local_enable=YES #
# Uncomment this to enable any form of FTP write command. write_enable=YES #
# Default umask for local users is 077. You may wish to change this to 022, # if your users expect that (022 is used by most other ftpd's) local_umask=022 #
# Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user. anon_upload_enable=YES #
# Uncomment this if you want the anonymous FTP user to be able to create # new directories.
anon_mkdir_write_enable=YES anon_other_write_enable=YES #
# Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES #
# Activate logging of uploads/downloads. xferlog_enable=YES #
# Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES #
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using \# recommended! chown_uploads=YES
#chown_username=whoever #
# You may override where the log file goes if you like. The default is shown # below.
xferlog_file=/var/log/vsftpd.log #
# If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. xferlog_std_format=YES #
# You may change the default value for timing out an idle session. #idle_session_timeout=600 #
# You may change the default value for timing out a data connection. #data_connection_timeout=120 #
# It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure #
# Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. async_abor_enable=YES #
# By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command \# predicted this attack and has always been safe, reporting the size of the # raw file.
# ASCII mangling is a horrible feature of the protocol. ascii_upload_enable=YES ascii_download_enable=YES #
# You may fully customise the login banner string: ftpd_banner=Welcome to blah FTP service. #
# You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks.