页次: 1
我使用的是 oh-my-zsh ,安装了 zsh-autosuggestions 自动补全插件
他在我本机的路径补全是很好用的,按tab 就能列出来好多选项
但是当我使用 rsync 或者 scp 时
比如 scp test@192.168.1.122:~/
我想把 192.168.1.122 test 目录下的 xxx 文件拷贝 到我本机上的时候 ,输入到 ~/ 我想按 tab 让他自动 给我补全 ~/ 下的 文件列表
他就 不管用了, 我只好 手动打上 xxx 这个文件 ,这样感觉不方便 ……
有没有什么插件 或者 配置 能让 zsh 支持 远程 路径 补全 呢?
离线
不是默认就有的么,还是说你 ssh key 登录和 ControlMaster 都没有设置?
离线
不是默认就有的么,还是说你 ssh key 登录和 ControlMaster 都没有设置?
我这里没有呀,我现在的流程是这样的
我先用 ssh-copy-id -i ~/.ssh/id_rsa.pub test@192.168.1.112 将我的 公钥 复制到 目标主机上去,
然后 再 ssh 登录就不用密码了 ,
然后 我 在我自己的的机器上 scp test@192.168.1.112:~/ 按 tab 补全是出不来的
这是我 本机的 ssh 配置
$ cat /etc/ssh/ssh_config
# $OpenBSD: ssh_config,v 1.35 2020/07/17 03:43:42 dtucker Exp $
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.
# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.
# Host *
# ForwardAgent no
# ForwardX11 no
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
# UserKnownHostsFile ~/.ssh/known_hosts.d/%k
#
#
#
#
ServerAliveInterval 50
ServerAliveCountMax 3
这是对应远程主机的 ssh 配置
# $OpenBSD: ssh_config,v 1.30 2016/02/20 23:06:23 sobrado Exp $
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.
# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.
# Host *
# ForwardAgent no
# ForwardX11 no
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Protocol 2
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
#
# Uncomment this if you want to use .local domain
# Host *.local
# CheckHostIP no
Host *
GSSAPIAuthentication yes
# If this option is set to yes then remote X11 clients will have full access
# to the original X11 display. As virtually no X11 client supports the untrusted
# mode correctly we set this to yes.
ForwardX11Trusted yes
# Send locale-related environment variables
SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
SendEnv XMODIFIERS
请问是 哪里配置的不对么? 导致 远程 路径的不全 tab 不出来 ,还是说我 zsh 配置的有问题?
离线
按说配好无密码登录就可以补全出来了呀。这个补全是由 zsh 自带的 /usr/share/zsh/functions/Completion/Unix/_ssh 提供的。难道你有什么配置把它覆盖或者干掉了?
那你在 scp test@192.168.1.112: 后按 tab 能补全不?
离线
按说配好无密码登录就可以补全出来了呀。这个补全是由 zsh 自带的 /usr/share/zsh/functions/Completion/Unix/_ssh 提供的。难道你有什么配置把它覆盖或者干掉了?
那你在 scp test@192.168.1.112: 后按 tab 能补全不?
唉,我不打那个波浪号 ,他就有补全出来啊 ? 这是为什么嘞?
离线
不知道。那你就别打了吧,反正那个是默认的起始目录。
离线
不知道。那你就别打了吧,反正那个是默认的起始目录。
嗯,之前 的习惯不好, 老喜欢打 波浪符号 前缀 ,以后 不打了 ,谢谢依云
离线
页次: 1