Server:node1 192.168.123.19 CentOS Release 6.5 (Final)
Client:node2 192.168.123.39 CentOS Release 6.5 (Final)
Requirements Description:
1. The server mainly stores some more important files.
2. Clear text transmission is not allowed.
3. Lock the user directory, you can upload and download files at home directory.
4. Users cannot log on to the Linux system.
5. Limit the speed of access and the number of users logged in.
Download and install the software;
General Yum Source is not, need to go to the official website to download
Official website: http://mysecureshell.sourceforge.net/en/download.html
wget http://mysecureshell.free.fr/repository/index.php/centos/6.4/mysecureshell-1.33-1.x86_64.rpm
RPM-IVH mysecureshell-1.33-1.x86_64.rpm
See which files the software generated:
[Email protected] ~]# RPM-QL Mysecureshell
/bin/mysecureshell
/bin/sftp-admin
/bin/sftp-kill
/bin/sftp-state
/bin/sftp-user
/bin/sftp-verif
/bin/sftp-who
/etc/logrotate.d/mysecureshell
/etc/ssh/sftp_config
Create the user and set the user's default shell to Mysecureshell:
Useradd-s/bin/mysecureshell Ftpuser
echo 123456|passwd--stdin Ftpuser
Configuration related options:
Globaldownload/globalupload is to set the global download speed.
Stayathome whether to lock the user in their home directory.
Limitconnection sets the maximum number of connections.
Limitconnectionbyuser/limitconnectionbyip limit the maximum number of connections per user/IP.
HOME specifies where the user directory is.
Validation results:
Service side:
[Email protected] ftpuser]# pwd
/home/ftpuser
[email protected] ftpuser]# Touch server.file
[email protected] ftpuser]# LL
Total 0
-rw-r--r--. 1 root root 0 may 22:42 Server.file
Client:
[[email protected] ~]# ssh [email protected]
[email protected] ' s password:
Last Login:thu-22:38:12 from 192.168.123.19
Shell access is disabled! Connection to 192.168.123.19 closed.
[Email protected] ~]# sftp [email protected]
Connecting to 192.168.123.19 ...
[email protected] ' s password:
Sftp> ls
Server.file
sftp> pwd
Remote working directory:/
Sftp> Cd/home
Couldn ' t stat remote file:no such file or directory
Sftp> Get Server.file
Fetching/server.file to Server.file
Sftp> put Install.log
Uploading Install.log To/install.log
Install.log 100% 32KB 31.8kb/s 00:00
Sftp>
Service side:
[email protected] ftpuser]# LL
Total 32
-rw-r--r--. 1 ftpuser ftpuser 32525 22:43 Install.log
-rw-r--r--. 1 root root 0 may 22:42 Server.file
Client:
[email protected] ~]# LL
Total 48
-RW-------. 1 root root 1377 may 21:18 anaconda-ks.cfg
-rw-r--r--. 1 root root 32525 may 21:18 Install.log
-rw-r--r--. 1 root root 5901 may 21:14 Install.log.syslog
-rw-r--r--. 1 root root 0 June 14:37 Server.file
This article is from the "unix-like" blog, make sure to keep this source http://alipay.blog.51cto.com/7119970/1711208
Using Mysecureshell to build SFTP