如何理解sftp server服务SftpGo,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
成都创新互联公司成立十年来,这条路我们正越走越好,积累了技术与客户资源,形成了良好的口碑。为客户提供网站设计制作、成都做网站、网站策划、网页设计、域名与空间、网络营销、VI设计、网站改版、漏洞修补等服务。网站是否美观、功能强大、用户体验好、性价比高、打开快等等,这些对于网站建设都非常重要,成都创新互联公司通过对建站技术性的掌握、对创意设计的研究为客户提供一站式互联网解决方案,携手广大客户,共同发展进步。
服务端主程序: sftpgosever
cli脚本: sftpcli
conf存储服务配置文件
data创建sftp用户目录
backups存储应用备份数据
本次基于k8s运行服务、mysql5.7做持久化存储、腾讯云NFS服务做数据目录、configmap挂载配置文件、nginx stream提供域名映射tcp访问
docker pull taylordang/sftpgo:v1.0
查看具体文档: [https://github.com/dtcka/sftpgo/tree/master/docker/sftpgo/alpine](https://github.com/dtcka/sftpgo/tree/master/docker/sftpgo/alpine)
构建脚本: [https://github.com/dtcka/sftpgo/blob/master/docker/rest-api-cli/Dockerfile](https://github.com/dtcka/sftpgo/blob/master/docker/rest-api-cli/Dockerfile)
{ "sftpd": { "bind_port": 2022, "bind_address": "0.0.0.0", "idle_timeout": 15, "max_auth_tries": 0, "umask": "0022", "banner": "", "upload_mode": 0, "actions": { "execute_on": [], "command": "", "http_notification_url": "" }, "keys": [], "kex_algorithms": [], "ciphers": [], "macs": [], "login_banner_file": "", "setstat_mode": 0, "enabled_ssh_commands": [ "md5sum", "sha1sum", "cd", "pwd", "scp" ], "keyboard_interactive_auth_program": "", "proxy_protocol": 0, "proxy_allowed": [] }, "data_provider": { "driver": "mysql", "name": "sftpgo", "host": "xxxxxx", "port": 9999, "username": "sftpgo", "password": "xxxxx", "sslmode": 0, "connection_string": "", "users_table": "users", "manage_users": 1, "track_quota": 2, "pool_size": 0, "users_base_dir": "", "actions": { "execute_on": [], "command": "", "http_notification_url": "" }, "external_auth_program": "", "external_auth_scope": 0, "credentials_path": "credentials", "pre_login_program": "" }, "httpd": { "bind_port": 8080, "bind_address": "0.0.0.0", "templates_path": "templates", "static_files_path": "static", "backups_path": "backups", "auth_user_file": "", "certificate_file": "", "certificate_key_file": "" } }
以上服务配置准备完成之后,运行容器会在数据库中自动生成对应的表
apiVersion: v1 kind: Service metadata: name: sftpgo namespace: sftp spec: clusterIP: xxxx externalTrafficPolicy: Cluster ports: - name: 8080-8080-tcp nodePort: 31807 port: 8080 protocol: TCP targetPort: 8080 - name: 2022-2022-tcp nodePort: 30865 port: 2022 protocol: TCP targetPort: 2022 selector: k8s-app: sftpgo qcloud-app: sftpgo sessionAffinity: None type: LoadBalancer status: loadBalancer: ingress: - ip: xxxx
- nginx配置文件 ``` apiVersion: v1 data: nginx.conf: |- user nginx; worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } stream { server { listen 2022; proxy_pass sftpgo服务对应的内网ip:2022; } } kind: ConfigMap metadata: name: tcp-config namespace: sftp
##### 3.测试下服务状态以及数据目录权限 ![image.png](https://oscimg.oschina.net/oscnet/up-bee83bd7e27b4e982526a9d3c88a450f7fe.png)
测试ok:数据权限UID GID需要设置为1003.
##### 4. 设置域名解析到nginx的externalIps即可实现域名访问 ![image.png](https://oscimg.oschina.net/oscnet/up-331b767e5d7c85d5f06f1a9c01daa105227.png) ---
附:
看完上述内容,你们掌握如何理解sftp server服务SftpGo的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注创新互联行业资讯频道,感谢各位的阅读!