AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[sftp](ubuntu)

Martin Hope
minisaurus
Asked: 2023-05-21 23:48:25 +0800 CST

Ubuntu 22.04 Gnome 文件网络如何通过 sftp 连接到监听 22 以外端口的机器

  • 6

刚刚将我的笔记本电脑升级到 22.04,非常好。

但是我不知道如何从文件应用程序连接到远程 linux;远程计算机未在端口 22 上侦听。

我可以使用命令行连接sftp -P not_port_22 [email protected]

在 18.04 上,在文件中,我可以在连接前配置端口号;我在 22.04 上找不到任何这样的选项

“文件”应用程序的屏幕截图

sftp
  • 1 个回答
  • 34 Views
Martin Hope
Kalif Vaughn
Asked: 2020-11-06 03:49:39 +0800 CST

SFTP get 抛出错误(curl 也不起作用)

  • 0

我正在通过终端连接到 SFTP 连接。我想下载一个文件。

如果我去文件夹,我可以列出内容:

ls

我可以清楚地看到文件;我们称之为“my_file.csv”。

如果我尝试这段代码:

sftp get my_file.csv

我收到此错误:

Connecting to get...
ssh: Could not resolve hostname get: Name or service not known
Couldn't read packet: Connection reset by peer

我可以使用“less my_file.csv”查看文件。它显然在那里并且可以访问,但是我无法使用我尝试的任何 sftp get 组合下载它(我尝试了很多选项)。我也尝试过使用 curl 但没有运气。

如果我输入 SFTP,我会得到以下选项:

usage: sftp [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]
            [-o ssh_option] [-P sftp_server_path] [-R num_requests]
            [-S program] [-s subsystem | sftp_server] host
       sftp [user@]host[:file ...]
       sftp [user@]host[:dir[/]]
       sftp -b batchfile [user@]host

任何帮助表示赞赏!我将其设置为最终按计划(例如,每小时)下载文件。

ssh cron sftp
  • 1 个回答
  • 409 Views
Martin Hope
Rosamunda
Asked: 2020-10-14 05:02:29 +0800 CST

如何使用 Nautilus 延长 SFTP 连接的超时时间?

  • 2

我使用 Nautilus 连接到远程服务器(不,我不喜欢 FileZilla)。但是经过一段时间的空闲时间,比如 5 分钟,它不允许我再次访问远程位置。

即使我只是再次安装服务器就可以对其进行排序,这也很烦人,正如您可以想象的那样,因为我需要每 5 分钟执行一次。

我在这里读过一个类似的问题,但这是一篇旧文章,它没有为 Ubuntu Focal Fossa 提供有效的解决方案。

我也读过这个其他问题,但我不确定答案是否适用于我的问题。

最后,我读过这篇似乎有问题的帖子,但还没有任何解决方案或解决方法吗?

这里似乎有一个建议的解决方法,但我也不知道该怎么做,或者它是否适用于这个问题(我假设给定的 Mint 和 Ubuntu 是基于 Debian 的系统,Mint 解决方案可以适用于 Ubuntu? )。

nautilus server ftp sftp
  • 1 个回答
  • 726 Views
Martin Hope
Srihari
Asked: 2020-09-16 00:35:06 +0800 CST

在 FTP 主动和被动模式下更改端口

  • 1

我是 FTP 协议的新手,在这里我已经阅读了 ftp 中的主动和被动模式。

主动模式:表示客户端将端口号发送到服务器进行数据通信。被动模式:表示服务器将端口号发送给客户端进行数据通信。

在这里,这些都还好

我的疑问是处于被动模式对于初始控制连接,两者都将在某个端口上进行通信,例如 5000。服务器接收到“PASV”命令后,服务器将发送端口号示例 5010。

  1. 服务器将端口号发送给客户端后,服务器是否应该关闭5000号端口,并开始列出5010端口?还是两个端口都应该处于活动状态?

  2. 对于命令我需要使用旧端口(5000),对于数据通信我需要使用新端口(5010),或者它是怎么回事?

谁能帮我这个

ftp network-manager sftp port-forwarding
  • 1 个回答
  • 267 Views
Martin Hope
konstapel
Asked: 2020-07-24 05:09:54 +0800 CST

挂载的 NAS 存储上的文件夹权限

  • 0

我创建了一个带有 Jailed 文件夹的 SFTP 服务器。我想将这些文件夹移动到已安装的 NAS 存储上。我的问题是来自挂载的正确文件夹权限。Linux Box 与 Active Directory 连接,因此用户和组可以从那里获得。

文件夹结构应该如何:

Appdata                      <- root:root 755
Appdata/SFTPdata             <- root:root 700
Appdata/SFTPData/%h          <- root:root 755
Appdata/SFTPData/%h/upload   <- user:usr-sftp 700

当我现在安装 NAS 存储时

mount -t cifs -o user=admin,gid=13371337,rw,forcegid,domain=DOMAIN.lan,iocharset=utf8,file_mode=0770,dir_mode=0770  //storage.DOMAIN.lan/SFTPTestUnix /Appdata/

作为 root,已安装驱动器中的所有文件夹现在都设置为 root:usr-sftp(gid 是 AD 组 usr-sftp)和 chmod 770(来自文件和 dir_mode)。

问题:我该如何解决这个问题。有一个更好的方法吗?我目前正在使用 cifs,nfs 更适合这个吗?

nas ssh mount sftp
  • 1 个回答
  • 1009 Views
Martin Hope
konstapel
Asked: 2020-07-15 01:34:43 +0800 CST

带有 Active Directory 身份验证的 SFTP(RealmD 和 SSSD)

  • 1

它应该是什么样子:我的 Ubuntu VM 通过 SSSD 连接到我的 Active Directory 服务器。我想要一个 SFTP 服务器来监禁分配了特定 AD 组 ([email protected]) 并且只有 SFTP 而不是 SSH 的传入用户。我的管理员用户及其分配的组 ([email protected]) 应该仍然能够通过 SSH 但不能通过 SFTP 登录。

现在情况如何:我的 SSSD 工作正常。SFTP 让我有问题。

sssd.conf:

[sssd]
domains = domain
config_file_version = 2
services = nss, pam
default_domain_suffix = domain

[domain/domain]
default_shell = /bin/bash
krb5_store_password_if_offline = True
cache_credentials = True
krb5_realm = domain
realmd_tags = manages-system joined-with-adcli
id_provider = ad
fallback_homedir = /home/%u@%d
ad_domain = domain
use_fully_qualified_names = True
ldap_id_mapping = True
access_provider = simple
simple_allow_groups = [email protected]

sshd.conf:

Subsystem sftp internal-sftp

Match Group usr-sftp
        ChrootDirectory /appdata/SFTPdata/%u
        ForceCommand internal-sftp -d /upload
        AllowTcpForwarding no
        GatewayPorts no
        X11Forwarding no

文件夹 /appdata/SFTPdata/%u 归 root 所有。文件夹 /appdata/SFTPdata/%u/upload 归用户所有。

当我在 sssd.conf 的允许组中添加 AD 组“usr-sftp”时,我能够通过 ssh 和 sftp 进行连接,但会被定向到 /home。

我不知道我在这一点上做错了什么。

ssh active-directory sftp sssd
  • 1 个回答
  • 3147 Views
Martin Hope
Buno
Asked: 2020-07-07 12:54:21 +0800 CST

可以登录 sftp,但不能登录 ssh shell

  • 1

我试图为我的服务器(Ubuntu 20.04)设置一个新的 sftp 用户。我创建了用户my-user,在他的文件中添加了一个公钥,.ssh/authorized_keys并决定在任何事情之前测试 SSH 登录。令我惊讶的是,Putty 在成功登录后立即关闭连接

我尝试从 Windows PowerShell 进行 ssh 并得到相同的结果(成功登录后立即断开连接)

最后,我尝试使用此登录名进行 sftp ... 效果很好,我仍然保持连接

我根本没有为这个用户设置 sftp 限制,所以我不知道是什么原因造成的。

这是我的 /etc/ssh/sshd_config

AcceptEnv LANG LC_*
AllowAgentForwarding no
#AllowGroups sudo
AllowTcpForwarding no
Banner /etc/issue.net
ChallengeResponseAuthentication no
Ciphers [email protected],[email protected],aes256-ctr
ClientAliveCountMax 0
ClientAliveInterval 3600
Compression no
GSSAPIAuthentication no
HostbasedAuthentication no
IgnoreUserKnownHosts yes
Include /etc/ssh/sshd_config.d/*.conf
KerberosAuthentication no
KexAlgorithms [email protected],ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
LogLevel VERBOSE
LoginGraceTime 20
Macs [email protected],[email protected],hmac-sha2-512,hmac-sha2-256
MaxAuthTries 3
MaxSessions 10
MaxStartups 10:30:60
PasswordAuthentication no
PermitEmptyPasswords no
PermitRootLogin no
PermitUserEnvironment no
Port 22
PrintLastLog yes
PrintMotd no
RekeyLimit 512M 1h
StrictModes yes
Subsystem sftp internal-sftp
TCPKeepAlive no
UseDNS no
UsePAM yes
X11Forwarding no

这是包含的唯一其他配置文件:

PermitRootLogin no
DebianBanner no
Protocol 2
LoginGraceTime 10
PasswordAuthentication no
ClientAliveInterval 3600
ClientAliveCountMax 0
AllowUsers ubuntu my-user
X11Forwarding no

最后,这是ssh -vvv [email protected]认证后的输出:

debug1: Authentication succeeded (publickey).
Authenticated to XXX.XXX.XXX.XXX ([XXX.XXX.XXX.XXX]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug1: console supports the ansi parsing
debug3: Successfully set console output code page from:437 to 65001
debug3: Successfully set console input code page from:437 to 65001
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 4
debug1: Remote: /home/my-user/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: client_check_window_change: changed
debug2: channel 0: request window-change confirm 0
debug3: send packet: type 98
debug3: channel 0: will not send data after close
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug3: Successfully set console output code page from 65001 to 437
debug3: Successfully set console input code page from 65001 to 437
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

debug3: send packet: type 1
debug3: Successfully set console output code page from 65001 to 437
debug3: Successfully set console input code page from 65001 to 437
Connection to XXX.XXX.XXX.XXX closed.
Transferred: sent 2912, received 2632 bytes, in 0.3 seconds
Bytes per second: sent 8646.7, received 7815.3
debug1: Exit status 1
server ssh sftp openssh
  • 1 个回答
  • 657 Views
Martin Hope
NealWalters
Asked: 2020-05-04 09:46:51 +0800 CST

OPEN SSH 未监听端口 22

  • 0

我在 Windows 10 笔记本电脑的 Virtual Box 上安装了 Ubuntu 20.4(包括 Open SSH)作为虚拟机。我安装了 Samba 以允许机器名称连接。

下面显示了端口 22 上的侦听器,以及 SSH 的状态。

在此处输入图像描述

我的ssh_config文件中未注释掉的行是:

Include /etc/ssh/ssh_config.d/*.conf 
Host * 
   Port 22 

Match Group filetransfer 
   ChrootDirectory %h 
   X11Forwarding no 
   AllowTcpForwarding no 
   ForceCommand internal-sftp 
   PasswordAuthentication yes
   PubkeyAuthentication no 

我打算先尝试用户/密码身份验证,然后在我开始工作后进行公钥身份验证。

在此处输入图像描述

在 Windows 命令提示符下,我可以 ping 机器,但不能对端口 22 执行“telnet”。

我还运行了这个命令来禁用任何防火墙:

sudo ufw disable

从这篇相关文章(如何开始监听端口 22)中,我从 Ubuntu 终端尝试了以下操作:

ssh -vvv localhost 

我不确定那是做什么的,因为我想从我的 Windows 机器连接。它响应以下内容:

debug1: /etc/ssh/ssh_confg line 19: cinclude /etc/ssh/ssh_config.d/*.conf matched no files 
debug1: /etc/ssh/ssh_config lin 21: Applying optiosn for * 
debug2: checking match for "group filetransfer' but localhost original localhost 
Unsupported Match attribute Group 
/etc/ssh/ssh_config line 51: Bad Match condition 

我不确定我是否应该运行它,但也许它表明我ssh_config的不正确?我检查了几个博客。

我按照这里的教程设置用户和组:https ://gist.github.com/lymanlai/3008244

当我安装 Ubuntu 20.4 时,我选中了“安装 OpenSSH 服务器”框,如下所示:

在此处输入图像描述

sftp openssh 20.04
  • 1 个回答
  • 3456 Views
Martin Hope
Dushan Savich
Asked: 2020-05-01 01:31:44 +0800 CST

Kdevelop 和 Kate kio 问题 - 不会保存 sftp:// 文件(也不会 fish://)

  • 0

我有 KUbuntu 19.10,我在使用 sftp 和 fish 协议从远程服务器打开和保存文件时遇到问题。

每当我尝试从远程位置打开文件时,它都会显示:“格式错误的 URL。” 在 KDevelop 和 Kate 中,当我尝试在 Kdevelop 中保存它时,它根本不保存文件,它只是忽略它,就像没有点击“保存”一样。

我尝试使用 Ubuntu Backports 将 KDE 升级到最新版本到 5.18.3,但问题变得更糟,现在 Kdevelop 甚至不会保存本地文件。

kio-extras 和 kio-extras-data 已安装。

KDE Plasma version is: 5.18.3
KDE Frameworks version is: 5.67.0
Qt Version: 5.12.4
Kernerl version: 5.3-0-51-generic
OS Type: 64bit.
CPU: Ryzen 7 3700X
Motherboard: ASUS TUF GAMING X570-PLUS (WI-FI)

谢谢!

kde ssh kate sftp kdevelop
  • 1 个回答
  • 203 Views
Martin Hope
Matifou
Asked: 2019-11-27 11:18:27 +0800 CST

Nautilus:为更改 IP 的 sftp 文件夹添加动态书签?

  • 1

我想在 nautilus 中添加一个书签到一个 sftp 服务器,它的 IP 地址会随着时间而改变。

我通过 sftp 连接到(谷歌云实例)服务器,在文件资源管理器中插入地址:

sftp://[email protected]/home/

其中 xx.xxx.xx.xx 是 IP 地址。我想将此添加为 Nautilus 中的书签,我可以轻松地使用ctrl +d. 但是,IP地址每天都在变化。我可以使用以下命令检索 IP 地址:

gcloud compute instances describe instancename --format="get(networkInterfaces[0].accessConfigs[0].natIP)"

有什么办法可以让我拥有一个动态的 Nautilus 书签,使用上面的命令来创建正确的地址?或者我可以自己运行命令来更新静态 nautilus 书签吗?

谢谢!

nautilus shortcuts sftp bookmarks
  • 1 个回答
  • 190 Views

Sidebar

Stats

  • 问题 199622
  • 回答 264146
  • 最佳答案 132073
  • 用户 66540
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve