martyr-deepin / deepin-terminal-gtk

DDE terminal emulator application
GNU General Public License v3.0
264 stars 57 forks source link

深度终端--远程管理 #116

Closed zhaoyunxing92 closed 5 years ago

zhaoyunxing92 commented 5 years ago

我在用深度的远程管理时一直提示请先确保服务器已经安装了rz和sz命令。 && exec $SHELL -l,我网上百度过很多方法但是一直不成功,但是我确实想用它,不想下载其他工具

BLumia commented 5 years ago

这个只是一个正常的使用提示,你只需要保证服务器上有安装这两个命令就行了,功能是确保右键提供的上传功能可用。

如果你的确遇到了功能不能使用的问题,烦请提供一下您的环境,如:你所使用的发行版,以及终端版本和完整的错误提示?

zhaoyunxing92 commented 5 years ago

您好,我昨天晚上版本升级到了15.9,我再终端里面ssh服务是可以了,但是用远程管理的时候就提示我安装rz和sz,

BLumia commented 5 years ago

提示是“确保安装”,无论是否已经安装都会有那条提示,我们并不会检查你的服务器上是否真正安装了 rzsz ,所以才会有那条提示,所以请放心使用 ;)

zhaoyunxing92 commented 5 years ago

![Uploading 深度截图_选择区域_20190123161506.png…]() 您好,这个就是我现在的情况,但是ssh是可以的

BLumia commented 5 years ago

您好,这个就是我现在的情况,但是 ssh 是可以的

你图片没传上来吧.......

zhaoyunxing92 commented 5 years ago

深度终端 不好意思啊,图片刚刚没有传成功

BLumia commented 5 years ago

看上去是正常的提示,没有问题的样子。你是远程连接在看到这样的提示之后发现实际连接失败了吗?

远程管理所使用的是 zssh 进行连接,对于 Deepin,使用的是包内附带的 zssh (于 /usr/lib/deepin-terminal/zssh,因为源里的有毛病)。你进行远程使用远程管理和自己使用 zssh 远程效果应当是一致的。

需要重申的是,如果你使用自带的远程管理功能,那么 请先确保服务器已经安装了rz和sz命令。 这个提示是无论如何都一定会显示的,这不代表你的远程连接失败了或者出了什么问题。

另,关于后两个报错,可参见 https://stackoverflow.com/questions/27021641/how-to-fix-request-failed-on-channel-0 或自行搜索解决方案。

zhaoyunxing92 commented 5 years ago

@BLumia 我最后没办法修改了脚步使用ssh

zhaoyunxing92 commented 5 years ago

这个是我调整好的脚本

#! /usr/bin/expect -f

# Copyright (C) 2011 ~ 2016 Deepin, Inc.
#               2011 ~ 2016 Wang Yong
#
# Author:     Wang Yong <wangyong@deepin.com>
# Maintainer: Wang Yong <wangyong@deepin.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

## All possible interactive messages:
# Are you sure you want to continue connecting (yes/no)?
# password:
# Enter passphrase for key

## Main
# Delete self for secret, will not affect the following code
file delete $argv0

# Setup variables
# Set timeout -1 to avoid remote server dis-connect.
set timeout -1
set user {<<USER>>}
set server {<<SERVER>>}
set password {<<PASSWORD>>}
set private_key {<<PRIVATE_KEY>>}
set port {<<PORT>>}
set authentication {<<AUTHENTICATION>>}
set ssh_cmd {/usr/bin/ssh}
set ssh_opt {$user@$server -p $port}
set remote_command {<<REMOTE_COMMAND>>}

# This code is use for synchronous pty's size to avoid terminal not update if login in remote server.
trap {
    stty rows [stty rows] columns [stty columns] < $spawn_out(slave,name)
} WINCH

# Spawn and expect
eval spawn $ssh_cmd $ssh_opt
if {[string length $password]} {
    expect {
        timeout {send_user "ssh connection time out, please operate manually\n"}
        -nocase "(yes/no)\\?" {send "yes\r"; exp_continue}
        -nocase -re "password:|enter passphrase for key" {
            send "$password\r"
        }
    }

}
interact