![WinSCP 必須不斷重新連線到我的 Ubuntu 伺服器](https://rvso.com/image/1416728/WinSCP%20%E5%BF%85%E9%A0%88%E4%B8%8D%E6%96%B7%E9%87%8D%E6%96%B0%E9%80%A3%E7%B7%9A%E5%88%B0%E6%88%91%E7%9A%84%20Ubuntu%20%E4%BC%BA%E6%9C%8D%E5%99%A8.png)
我使用的是 Window 7 計算機,因此只能使用 WinSCP 之類的工具來管理執行 Ubuntu 的遠端伺服器。
我也使用一個很好的舊命令列,但對於文件管理,我通常使用 WinSCP,它是一個很好的工具,其作用類似於 FTP 用戶端,但我相信它是透過 SSH 或 SFTP 來代替的。
現在,如果閒置 10-20 分鐘(我不知道實際時間)後,當我通過 WinSCP 傳輸文件時,它必須重新連接,它會像重新連接一樣,這會減慢我的速度;速度很快過程並且不會再次要求我輸入密碼或密鑰文件...但它似乎超時或斷開連接到某個點...我不確定它是否真的斷開連接,因為牠喜歡重新連接馬上就可以了,但確實需要15-30 秒,這很煩人。
我很想找到一種方法,讓它始終保持快速和敏捷,就好像我一直在連接一樣,而不是像閒置一段時間後那樣超時。
所以我想問,這可能是 WinSCP 中的設定或問題,還是更有可能我認為這是我的伺服器中的設定?
關於如何延長其保持登入狀態而不一直重新連線的時間有什麼想法嗎?
我在某個地方看到了一個 SSH 配置文件,所以我sshd_config
在etc/ssh/sshd_config
下面的內容中找到了這個文件,我沒有看到任何對我自己來說很突出的東西(不多說)...
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
答案1
您的系統和遠端系統之間很可能有一個狀態防火牆/nat,它會在 15/20 分鐘後逾時連接的狀態資料。修改客戶端中的 keepalive 設定。我通常使用 120 秒的值。
修改導致問題的防火牆/NAT 設備也是可能的,但可能會產生其他副作用。
開啟以下對話框會議/站點/站點經理: