- 浏览: 2560286 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Build Home NAS(2)SmbClient SFTP FTP
1. SmbClient
Try with the smbclient on that server
> smbclient //localhost/sillycat-nas -b 8192 -c "put README.md" -U sillycat
Enter sillycat's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
putting file README.md as \README.md (0.6 kb/s) (average 0.6 kb/s)
But I fail to connect that from outside the internal network. I will try forwarding other ports later.
135,137-139, and 445
It seems that samba solution is not secure. I will check other solution.
Remote samba and I will cut the forwarding later.
> sudo apt-get remove samba
2. FTP/SFTP Solution
SFTP
Create the new user
> sudo useradd kiko -m -G users
> sudo useradd kangping -m -G users
> sudo useradd xieqiuyuan -m -G users
> sudo passwd kiko
> sudo passwd kangping
> sudo passwd xieqiuyuan
Mapping the disk to the new user
> sudo ln -s /opt/disk1/share /home/sillycat/home-nas
Then we can use some other SFTP client to directly connect to server from SSH port.
FileZilla and other things. But it seems that we can not limit the user to its own directory.
FTP
http://mina.apache.org/ftpserver-project/
Download the latest version
> wget http://apache.mirrors.lucidnetworks.net/mina/ftpserver/1.0.6/dist/ftpserver-1.0.6.tar.gz
Unzip and place in the working directory
Command to run
> bin/ftpd.sh res/conf/ftpd-typical.xml
Prepare the directory
> sudo ln -s /opt/disk1/users/sillycat /opt/ftpserver/res/home/sillycat/sillycat
> sudo ln -s /opt/disk1/share /opt/ftpserver/res/home/sillycat/share
FTP Command Line
> sudo apt-get install ftp
> ftp localhost 2121
I login the system with these command
ftp localhost 2121
Connected to localhost.
220 Service ready for new user.
Name (localhost:carl): sillycat
331 User name okay, need password for sillycat.
Password:
230 User logged in, proceed.
Remote system type is UNIX.
ftp>
Upload the file
ftp> put README.md
local: README.md remote: README.md
200 Command PORT okay.
150 File status okay; about to open data connection.
226 Transfer complete.
List the file
ftp> ls -l
200 Command PORT okay.
150 File status okay; about to open data connection.
-rw------- 1 user group 0 Nov 5 22:52 111.txt
-rw------- 1 user group 147 Nov 5 22:54 README.md
226 Closing data connection.
delete the file
ftp> mdelete 111.txt
mdelete 111.txt? y
250 Requested file action okay, deleted /111.txt.
3. Passive and Active in FTP
My just use very simple configuration in the ftp server, but it seems that I have some problem on connect to it. So I come back and search what are the details in FTP protocol.
There are 2 Types of Data Transfers - Active (PORT) and Passive(PASV)
The client problem can specify active mode by sending the “PORT” command to instruct that the server should connect back to a specified IP address and port number and then send the data.
A client program can choose passive mode by using the “PASV” command to ask that the server tell the client an IP address and port number that the client can connect to and receive the data.
http://www.ncftp.com/ncftpd/doc/misc/ftp_and_firewalls.html
Active FTP :
command : client >1023 -> server 21
data : client >1023 <- server 20
Passive FTP :
command : client >1023 -> server 21
data : client >1024 -> server >1023
Command passive will on/off the mode
I will change to use passive mode and I will also have the settings as follow:
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd
"
id="nasServer"
max-logins="20"
anon-enabled="false"
max-login-failures="3"
login-failure-delay="500">
<listeners>
<nio-listener name="default" port="2121" local-address="192.168.0.198">
<ssl>
<keystore file="./res/ftpserver.jks" password="password" />
</ssl>
<data-connection idle-timeout="60">
<active enabled="false" local-address="192.168.0.198" local-port="2020" ip-check="true" />
<passive ports="2023-2043" address="192.168.0.198" external-address="sillycat.ddns.net" />
</data-connection>
</nio-listener>
</listeners>
<file-user-manager file="./res/conf/users.properties" encrypt-passwords="false"/>
</server>
We can also adjust the logging here
/opt/ftpserver/common/classes
cat log4j.properties
log4j.rootLogger=INFO, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=./res/log/ftpd.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=[%5p] %d [%X{userName}] [%X{remoteIp}] %m%n
And I am using FileZilla on MAC and FTPManager on iOS.
References:
Previous Blog
http://sillycat.iteye.com/blog/2254550
Mac OS to samba
http://users.wfu.edu/yipcw/atg/apple/smb/
Remaining Rsync work
http://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/
http://www.makeuseof.com/tag/turn-your-raspberry-pi-into-a-nas-box/
SFTP and Clients
https://cyberduck.io/
https://filezilla-project.org/
FTP
http://sillycat.iteye.com/blog/562426
http://sillycat.iteye.com/blog/562428
http://sillycat.iteye.com/blog/563904
http://sillycat.iteye.com/blog/563906
http://sillycat.iteye.com/blog/563908
http://sillycat.iteye.com/blog/563909
1. SmbClient
Try with the smbclient on that server
> smbclient //localhost/sillycat-nas -b 8192 -c "put README.md" -U sillycat
Enter sillycat's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
putting file README.md as \README.md (0.6 kb/s) (average 0.6 kb/s)
But I fail to connect that from outside the internal network. I will try forwarding other ports later.
135,137-139, and 445
It seems that samba solution is not secure. I will check other solution.
Remote samba and I will cut the forwarding later.
> sudo apt-get remove samba
2. FTP/SFTP Solution
SFTP
Create the new user
> sudo useradd kiko -m -G users
> sudo useradd kangping -m -G users
> sudo useradd xieqiuyuan -m -G users
> sudo passwd kiko
> sudo passwd kangping
> sudo passwd xieqiuyuan
Mapping the disk to the new user
> sudo ln -s /opt/disk1/share /home/sillycat/home-nas
Then we can use some other SFTP client to directly connect to server from SSH port.
FileZilla and other things. But it seems that we can not limit the user to its own directory.
FTP
http://mina.apache.org/ftpserver-project/
Download the latest version
> wget http://apache.mirrors.lucidnetworks.net/mina/ftpserver/1.0.6/dist/ftpserver-1.0.6.tar.gz
Unzip and place in the working directory
Command to run
> bin/ftpd.sh res/conf/ftpd-typical.xml
Prepare the directory
> sudo ln -s /opt/disk1/users/sillycat /opt/ftpserver/res/home/sillycat/sillycat
> sudo ln -s /opt/disk1/share /opt/ftpserver/res/home/sillycat/share
FTP Command Line
> sudo apt-get install ftp
> ftp localhost 2121
I login the system with these command
ftp localhost 2121
Connected to localhost.
220 Service ready for new user.
Name (localhost:carl): sillycat
331 User name okay, need password for sillycat.
Password:
230 User logged in, proceed.
Remote system type is UNIX.
ftp>
Upload the file
ftp> put README.md
local: README.md remote: README.md
200 Command PORT okay.
150 File status okay; about to open data connection.
226 Transfer complete.
List the file
ftp> ls -l
200 Command PORT okay.
150 File status okay; about to open data connection.
-rw------- 1 user group 0 Nov 5 22:52 111.txt
-rw------- 1 user group 147 Nov 5 22:54 README.md
226 Closing data connection.
delete the file
ftp> mdelete 111.txt
mdelete 111.txt? y
250 Requested file action okay, deleted /111.txt.
3. Passive and Active in FTP
My just use very simple configuration in the ftp server, but it seems that I have some problem on connect to it. So I come back and search what are the details in FTP protocol.
There are 2 Types of Data Transfers - Active (PORT) and Passive(PASV)
The client problem can specify active mode by sending the “PORT” command to instruct that the server should connect back to a specified IP address and port number and then send the data.
A client program can choose passive mode by using the “PASV” command to ask that the server tell the client an IP address and port number that the client can connect to and receive the data.
http://www.ncftp.com/ncftpd/doc/misc/ftp_and_firewalls.html
Active FTP :
command : client >1023 -> server 21
data : client >1023 <- server 20
Passive FTP :
command : client >1023 -> server 21
data : client >1024 -> server >1023
Command passive will on/off the mode
I will change to use passive mode and I will also have the settings as follow:
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd
"
id="nasServer"
max-logins="20"
anon-enabled="false"
max-login-failures="3"
login-failure-delay="500">
<listeners>
<nio-listener name="default" port="2121" local-address="192.168.0.198">
<ssl>
<keystore file="./res/ftpserver.jks" password="password" />
</ssl>
<data-connection idle-timeout="60">
<active enabled="false" local-address="192.168.0.198" local-port="2020" ip-check="true" />
<passive ports="2023-2043" address="192.168.0.198" external-address="sillycat.ddns.net" />
</data-connection>
</nio-listener>
</listeners>
<file-user-manager file="./res/conf/users.properties" encrypt-passwords="false"/>
</server>
We can also adjust the logging here
/opt/ftpserver/common/classes
cat log4j.properties
log4j.rootLogger=INFO, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=./res/log/ftpd.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=[%5p] %d [%X{userName}] [%X{remoteIp}] %m%n
And I am using FileZilla on MAC and FTPManager on iOS.
References:
Previous Blog
http://sillycat.iteye.com/blog/2254550
Mac OS to samba
http://users.wfu.edu/yipcw/atg/apple/smb/
Remaining Rsync work
http://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/
http://www.makeuseof.com/tag/turn-your-raspberry-pi-into-a-nas-box/
SFTP and Clients
https://cyberduck.io/
https://filezilla-project.org/
FTP
http://sillycat.iteye.com/blog/562426
http://sillycat.iteye.com/blog/562428
http://sillycat.iteye.com/blog/563904
http://sillycat.iteye.com/blog/563906
http://sillycat.iteye.com/blog/563908
http://sillycat.iteye.com/blog/563909
发表评论
-
Stop Update Here
2020-04-28 09:00 322I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 484NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 374Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 375Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 345Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 436Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 444Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 381Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 463VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 394Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 487NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 432Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 342Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 255GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 456GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 332GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 318Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 324Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 302Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(1)Running with Component
2020-02-19 01:17 315Serverless with NodeJS and Tenc ...
相关推荐
官方离线安装包,亲测可用
"Linux网络服务FTP文件传输服务" FTP(File Transfer Protocol)是一种常用的文件传输协议,允许用户在网络上传输文件。FTP服务是一种基于客户端/服务器架构的服务,客户端发出请求,服务器响应请求并提供文件传输...
FTP(File Transfer Protocol)和SMB(Server Message Block)是两种常见的网络文件共享协议,用于在客户端和服务器之间传输文件。本文将详细讲解这两种协议的工作原理、特点以及如何使用它们来下载和删除远程服务器...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
下载jar后,把jcifs-1.3.18.3.jar放在代码build.gradle同级新建的文件夹libs中。工程的app.build.gradle里面加上包的导入: implementation files('libs/jcifs-1.3.18.3.jar') 资源里面有参考代码。
pecl install smbclient 二进制软件包安装 一些发行版提供了二进制软件包: Fedora / RHEL / CentOS的RPM: Debian的DEB: 适用于Ubuntu的DEB: 从源安装 通过软件包libsmbclient-dev(Debian / Ubuntu)或...
执行 smbclient 命令成功后,进入 smbclient 环境,可以执行和 ftp 命令中相似的命令:cd, lcd, get, mget, put, mput 等。 在 WINDOWS 机子上访问 LINUX 资源需要使用两个进程:nmbd 和 smbd。nmbd 是提供 WINDOWS...
另一方面,smbclient运行正常。 因此,我为smbclient写了一个包装器,该包装器会自动测试所有找到的共享的读写权限。 验证是通过空会话(即没有用户名和密码)完成的。 脚本smbclientmap.sh执行以下操作: 该脚本将...
smbclient的Node.js包装器 要求 要求必须安装Node.js 10+ Smbclient。 可以使用sudo apt-get install smbclient安装在Ubuntu上。 原料药 const SambaClient = require ( 'samba-client' ) ; let client = new Samba...
2. **SFTP (SSH File Transfer Protocol)**: SFTP利用SSH(Secure Shell)协议进行文件传输,提供安全的连接和数据加密。它常用于Linux服务器和Windows客户端之间的文件传输,尤其是在需要保护数据隐私的情况下。 3...
- **Linux客户端访问**:在Linux主机中,确认网络配置正确后,使用`smbclient`命令查看NAS共享目录,并可通过`mount`命令将共享目录挂载至本地目录,实现跨平台文件访问与管理。 #### 扩容与NFS共享配置 - **扩展...
此RAR压缩包包含了几个关键的库文件,它们使得Java程序能够实现对SMB2和SMB3协议的支持。 1. **bcprov-jdk15to18-169.jar**:这是Bouncy Castle加密库的一个版本,提供广泛的加密算法和PKI(Public Key ...
#### 2. 获取Android内核源码并编译 这一部分将介绍如何获取Android内核源码以及编译流程。 ##### 2.1 获取Android内核源码 获取Android内核源码的方法与之前获取整个Android源码类似,主要区别在于源码仓库的...
4. **FTP (File Transfer Protocol)**: 虽然不如SFTP安全,FTP仍然是一个常见的文件共享选项。安装vsftpd或ProFTPD等FTP服务器,配置用户账户和权限,然后通过FTP客户端连接到服务器进行文件操作。 5. **WebDAV**: ...
- **gp2 目录**:`group1` 和 `group2` 用户可读,但只有 `group2` 用户可写。 - **public 目录**:所有人都只能读取。 3. **重启 Samba 服务**:同上。 4. **测试共享目录**: - 在 Windows 和 Debian 上测试...
官方离线安装包,亲测可用
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 修改用户属性 passwd 修改口令 passwd user1 修改一个用户的口令 (只允许root执行) chage -E 2005-12-31 user1 设置用户口令的失效期限 ...
- FTP/FTPS/SFTP:通过FTP(File Transfer Protocol)、FTPS(FTP over SSL/TLS)或SFTP(Secure File Transfer Protocol),可以在安全的环境下进行文件传输。Python的ftplib和paramiko库提供了相应的支持。 - ...
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
- **访问共享资源**:Samba 提供了一个类似于 FTP 客户端的工具叫做 `smbclient`,这个命令可以用来访问 Windows 共享或 Linux 提供的 Samba 共享。例如,可以通过命令 `smbclient //hostname/sharename -U ...