[GH-ISSUE #1815] How to set begin remote dirs with docker container when use sftp mode #1081

Closed
opened 2026-02-27 00:02:10 +03:00 by kerem · 8 comments
Owner

Originally created by @Sylor-huang on GitHub (Sep 2, 2020).
Original GitHub issue: https://github.com/electerm/electerm/issues/1815

Electerm version:

v1.4.4

Operating system(linux, macos, or windows7/8/10?):

Macos 10.14.6

Detailed Description

When I use electerm to connect docker container in Ubuntu Server and use sftp mode, it can only get the Begin Dir:Remote as Ubuntu Server /root`.

How can I link to the docker dir ,such as "/home/pdl/xxx"?

image

TKS~

Originally created by @Sylor-huang on GitHub (Sep 2, 2020). Original GitHub issue: https://github.com/electerm/electerm/issues/1815 <!--- Provide some basic info --> ## Electerm version: v1.4.4 ## Operating system(linux, macos, or windows7/8/10?): Macos 10.14.6 ## Detailed Description When I use `electerm` to connect docker container in `Ubuntu Server` and use sftp mode, it can only get the `Begin Dir:Remote` as `Ubuntu Server` /root`. How can I link to the docker dir ,such as "/home/pdl/xxx"? ![image](https://user-images.githubusercontent.com/26167245/91938901-6a3b4c80-ed27-11ea-8c9c-59729fee7623.png) TKS~
kerem closed this issue 2026-02-27 00:02:10 +03:00
Author
Owner

@zxdong262 commented on GitHub (Sep 2, 2020):

没有理解你的描述 开始目录:远程输入 /home/xxx/xxx 不可以?

<!-- gh-comment-id:685531849 --> @zxdong262 commented on GitHub (Sep 2, 2020): 没有理解你的描述 开始目录:远程输入 `/home/xxx/xxx` 不可以?
Author
Owner

@Sylor-huang commented on GitHub (Sep 2, 2020):

你好,好像不行的。
因为在跳板机服务器只有/root 目录,没有这个 /home/xx/xx目录,

如果我在ssh设置里设置了开始目录:远程为 /home/xx/xx,会出现报错,-bash: cd: /home/pdl: No such file or directory,且下面的链接docker脚本 不会运行的。

image
image

<!-- gh-comment-id:685545024 --> @Sylor-huang commented on GitHub (Sep 2, 2020): 你好,好像不行的。 因为在跳板机服务器只有`/root` 目录,没有这个 `/home/xx/xx`目录, 如果我在ssh设置里设置了开始目录:远程为 `/home/xx/xx`,会出现报错,`-bash: cd: /home/pdl: No such file or directory`,且下面的链接docker脚本 不会运行的。 ![image](https://user-images.githubusercontent.com/26167245/91968128-c3ff3f00-ed46-11ea-9c63-3c3d84a3fed3.png) ![image](https://user-images.githubusercontent.com/26167245/91968198-ded1b380-ed46-11ea-99ff-9db442918163.png)
Author
Owner

@zxdong262 commented on GitHub (Sep 2, 2020):

那就设置为可以访问的路径?

<!-- gh-comment-id:685597035 --> @zxdong262 commented on GitHub (Sep 2, 2020): 那就设置为可以访问的路径?
Author
Owner

@Sylor-huang commented on GitHub (Sep 2, 2020):

我看到设置开始远程目录:远程 是在进入第一层服务器成功后,开始执行的cd xx命令。

如果是为docker容器的话,好像没链接docker前,通过cd 命令是进不去容器的。

如果第一层服务器仅为 跳板机服务器的话,第二层(docker/或者其他)才为真实的代码运行服务器,如果需要在进入到这层服务器之后,再执行 开始远程目录:远程的话,可以这样做的吗:

  1. 修改开始远程目录:远程 的执行逻辑,在第一层登录成功后,判断是否有运行脚本,如果有的话,等 运行脚本 返回成功后,再执行这段代码,否则立即执行 运行脚本。
  2. 可以新增 在运行脚本内容返回成功后,再执行的 开始远程目录:远程 吗?

感谢大佬的回复,以上仅为个人建议,如有不妥请忽略。

<!-- gh-comment-id:685624332 --> @Sylor-huang commented on GitHub (Sep 2, 2020): 我看到设置`开始远程目录:远程` 是在进入第一层服务器成功后,开始执行的`cd xx`命令。 如果是为docker容器的话,好像没链接docker前,通过cd 命令是进不去容器的。 如果第一层服务器仅为 跳板机服务器的话,第二层(docker/或者其他)才为真实的代码运行服务器,如果需要在进入到这层服务器之后,再执行 `开始远程目录:远程`的话,可以这样做的吗: 1. 修改`开始远程目录:远程` 的执行逻辑,在第一层登录成功后,判断是否有`运行脚本`,如果有的话,等 运行脚本 返回成功后,再执行这段代码,否则立即执行 运行脚本。 2. 可以新增 在`运行脚本`内容返回成功后,再执行的 `开始远程目录:远程` 吗? 感谢大佬的回复,以上仅为个人建议,如有不妥请忽略。
Author
Owner

@zxdong262 commented on GitHub (Sep 2, 2020):

@Sylor-huang 如果把远程目录留空,运行脚本里执行需要的cd等等操作可以吗?既然运行脚本可以执行多个操作

<!-- gh-comment-id:685803511 --> @zxdong262 commented on GitHub (Sep 2, 2020): @Sylor-huang 如果把远程目录留空,运行脚本里执行需要的cd等等操作可以吗?既然运行脚本可以执行多个操作
Author
Owner

@Sylor-huang commented on GitHub (Sep 3, 2020):

image
可以在脚本里添加 cd等操作的,但是进入docker后,点击 sftp, 服务器的文件夹还是跳板机(第一层服务器)的文件夹呢。。

image

感谢您的耐心解答~

<!-- gh-comment-id:686217200 --> @Sylor-huang commented on GitHub (Sep 3, 2020): ![image](https://user-images.githubusercontent.com/26167245/92065745-c7400c80-edd2-11ea-86d6-864350266dd2.png) 可以在脚本里添加 cd等操作的,但是进入docker后,点击 sftp, 服务器的文件夹还是跳板机(第一层服务器)的文件夹呢。。 ![image](https://user-images.githubusercontent.com/26167245/92066020-7b419780-edd3-11ea-8310-3316e4dc2410.png) 感谢您的耐心解答~
Author
Owner

@zxdong262 commented on GitHub (Sep 3, 2020):

image
可以在脚本里添加 cd等操作的,但是进入docker后,点击 sftp, 服务器的文件夹还是跳板机(第一层服务器)的文件夹呢。。

image

感谢您的耐心解答~

sftp的初始路径还没有跟ssh和当前路径结合起来

<!-- gh-comment-id:686278505 --> @zxdong262 commented on GitHub (Sep 3, 2020): > ![image](https://user-images.githubusercontent.com/26167245/92065745-c7400c80-edd2-11ea-86d6-864350266dd2.png) > 可以在脚本里添加 cd等操作的,但是进入docker后,点击 sftp, 服务器的文件夹还是跳板机(第一层服务器)的文件夹呢。。 > > ![image](https://user-images.githubusercontent.com/26167245/92066020-7b419780-edd3-11ea-8310-3316e4dc2410.png) > > 感谢您的耐心解答~ sftp的初始路径还没有跟ssh和当前路径结合起来
Author
Owner

@Sylor-huang commented on GitHub (Sep 3, 2020):

好的,非常感谢~

<!-- gh-comment-id:686280452 --> @Sylor-huang commented on GitHub (Sep 3, 2020): 好的,非常感谢~
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/electerm#1081
No description provided.