您的位置:首页 > 编程语言 > PHP开发

nano命令和ftp服务器

2017-01-24 17:03 183 查看
1.什么时候用nano?

一般网络很卡,ssh时一用vim/vi 就死窗口,或者死机的情况

2.如何使用?

 打开或新建文件

#nano 文件名  vi nano /etc/test.c

禁用自动换行

#nano -w /etc/fstab

树莓派使用ftp服务器在windows和树莓派之间传文件

1 在linux系统安装ftp,那个工具叫做vsftpd,vsftpd是开源的轻量级的常用ftp服务器

sudo apt-get install vsfptd

2 启动ftp服务

Sudo service vsftpd start

3 配置ftp文件

sudo nano /etc/vsftpd.conf

展示vsftpd.conf+翻译

# The default compiled in settings are fairly paranoid. This sample file

a# loosens things up a bit, to make the ftp daemon more usable.

# Please see vsftpd.conf.5 for all compiled in defaults.

这个默认编译时相当偏执的。为了让ftp守护进程更加有用,这个示例对于配置稍微放松一点。请参阅

vsftpd.conf.5所有编译的缺省值。

# 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.

这个示例文件并不是一个详尽的vsftp选项清单。请读vsfftp.conf.5手册获取一个完整的vsftpd的

功能

# Run standalone?  vsftpd can run either from an inetd or as a standalone

# daemon started from an initscript.

独立运行?从initscript开始,vsftpd可以从一个inetd运行,或者是一个独立的守护进程

#需要配置的语句1
listen=YES//这句话才是在配置文件里面真正执行的,前面加#的都只是注释

# This directive enables listening on IPv6 sockets. By default, listening

# on the IPv6 "any" address (::) will accept connections from both IPv6

# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6

# sockets. If you want that (perhaps because you want to listen on specific

# addresses) then you must run two copies of vsftpd with two configuration

# files.

这个指令允许监听IPv6的sockets。默认情况下,监听到的IPv6任何地址会允许从IPv6和IPv4客户端

的连接。监听IPv4和IPv6的socket并不是必要的。如果你想要(可能因为你想要去监听一些特殊的

地址),然后你必须运行两个配置文件的复印件

需要配置的语句2

listen_ipv6=NO

# Allow anonymous FTP? (Disabled by default).允许匿名的FTP吗

anonymous_enable=NO

#Uncomment this to allow local users to log in

取消允许本地客户登陆

需要修改的语句3
local_enable=YES允许本地客户登陆

# Uncomment this to enable any form of FTP write command.

取消允许任何形式的FTP写请求

需要修改的语句4

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

默认掩码是077,你可能希望是022,如果你的用户希望是022(022被大多数的ftp使用)

本地掩码:022

配置到这里已经完成,如果需要进一步设置的话,例如这里的设置对匿名用户是不给予任何权限的,假如想要对匿名用户给予权限,则要仔细阅读配置文件进行下一步配置

可以通过cuteftp将文件从windows传送到板子上:

cuteftp只是一个ftp工具,也可以用其他的ftp工具

可以将windows任意目录的文件共享到/home/pi这个文件目录下(只能共享到pi这个目录,其他目录不够权限)

假如要共享到其他目录下,两个办法,1 修改配置文件 2 修改目录权限

下面讲解第二种方法:

假如我要将文件放置到pi的/boot/overlays

1 修改目录权限

sudo chmod 777 /boot/overlays

777是目录拥有的权限,

读、写、运行三项权限可以用数字表示,就是r=4,w=2,x=1。三个7就是user 用户组和其他人

2 cp /目录1/文件名  /目录2

cp是将文件从目录1复制到目录2
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息