日期:2014-05-16  浏览次数:20720 次

linux 安装 sftp
1,sftp:登陆命令
Xshell:\> sftp root@192.168.159.128


Connecting to 192.168.159.128:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Your current local directory is
C:\Program Files\NetSarang\Xshell 4

2,help命令
sftp:/root> help
bye     finish your SFTP session
cd      change your remote working directory
clear   clear screen
exit    finish your SFTP session
explore explore your local directory
get     download a file from the server to your local machine
help    give help
lcd     change and/or print local working directory
lls     list contents of a local directory
lpwd    print your local working directory
ls      list contents of a remote directory
mkdir   create a directory on the remote server
mv      move or rename a file on the remote server
put     upload a file from your local machine to the server
pwd     print your remote working directory
quit    finish your SFTP session
rename  move or rename a file on the remote server
rm      delete a file
rmdir   remove a directory on the remote server


3,sftp账户
sftp    supanccy123

4,安装sftp
redhat fedora 系列系统
客户端 yum install openssh  
服务端 yum install openssh-server


5,查看是否安装openss软件
[root@localhost ~]# rpm -q openssh-server
openssh-server-5.3p1-94.el6.i686
[root@localhost ~]#


6,sftp配置
、添加用户组

复制代码 代码示例:
groupadd sftp
2、添加用户并设置为sftp组

复制代码 代码示例:
sudo useradd -g sftp -s /sbin/nologin -M sftp
3、修改sftp用户的密码

复制代码 代码示例:
sudo passwd sftp 
***********
4、创建sftp用户的根目录并设置拥有者和组,修改权限(755)

复制代码 代码示例:
cd /home 
sudo mkdir sftp 
     
sudo chown root:sftp sftp 
sudo chmod 755 sftp
5、在sftp的目录中创建admin可写的目录

复制代码 代码示例:
cd sftp 
sudo mkdir report 
sudo chown admin:sftp report/
6、修改配置文件

复制代码 代码示例:
sudo vim /etc/ssh/sshd_config
修改
#Subsystem      sftp    /usr/libexec/openssh/sftp-server 
Subsystem       sftp    internal-sftp
7、在sshd_config文件最后添加

复制代码 代码示例:
Match User sftp 
X11Forwarding no 
AllowTcpForwarding no 
ForceCommand internal-sftp 
ChrootDirectory /home/sftp
8、重启sshd服务

复制代码 代码示例:
sudo service sshd restart
ftp client:
address : 192.168.1.10
user: sftp
password: xxxxxxx
protocol type : SSH2
port: 22
server folder: /home/sftp
pls use CuteFTP Pro? 8.3.3 or last version.
because CuteFTP Pro? 8.3.2 or earlier has no AES128 and AES256 ciphers.
will raise throw "SFTP21 error = #4" .




9,卸载opernssh-server
[root@localhost ~]# rpm -q openssh-server
openssh-server-5.3p1-94.el6.i686
[root@localhost ~]# rpm -e openssh-server-5.3p1-94.el6.i686
warning: /etc/ssh/sshd_config saved as /etc/ssh/sshd_config.rpmsave
[root@localhost ~]# rpm -e openssh-server-5.3p1-94.el6.i686
error: package openssh-server-5.3p1-94.el6.i686 is not installed
[root@localhost ~]# rpm -q openssh-server
package openssh-server is not installed


10,linux 软件卸载
configure作用:是源码安装软件时配置环境用的 他根据你的配置选项和你的系统情况生成makefile文件 为make 做准备

最常用的参数: ./