Ubuntu下TigerVNC传输大文件的方法
TigerVNC兼容多数VNC Viewer(如RealVNC、TightVNC)的内置文件传输功能,操作步骤如下:
192.168.1.100:1),点击连接并输入VNC密码。若需更安全的传输(避免VNC端口直接暴露),可通过SSH隧道加密流量,再使用SCP或SFTP工具传输大文件:
user为Ubuntu用户名,vnc_server_ip为服务器IP):ssh -L 5901:localhost:5901 user@vnc_server_ip
此命令将本地5901端口转发至服务器的5901端口(TigerVNC默认端口)。localhost:1(转发后的端口对应显示号:1),连接并输入VNC密码。scp /path/to/local/large_file user@localhost:/path/to/remote/directory(替换为实际路径)。scp user@localhost:/path/to/remote/large_file /path/to/local/directory。为提升大文件传输速度,可调整TigerVNC Server的配置参数:
~/.vnc/xstartup或/etc/vnc.conf),添加/修改以下参数:CompressionLevel=6  # 压缩级别(1-9,6为平衡值,过高会增加CPU负载)
Encoding=Zlib       # 使用Zlib压缩算法(适合文本/普通文件)
# 若网络带宽有限,可降低色彩深度(如16位):
-depth 16           # 设置色彩深度为16位(默认24位)
vncserver -kill :1  # 杀死当前会话(:1为显示号)
vncserver :1        # 重启会话
若需频繁传输大文件,可在Ubuntu上搭建Samba共享,实现局域网内Windows与Ubuntu之间的高效文件共享:
sudo apt update && sudo apt install samba
/etc/samba/smb.conf,在末尾添加:[shared]
path = /path/to/shared/folder  # 替换为实际共享目录
available = yes
valid users = your_username    # 替换为允许访问的Ubuntu用户
read only = no
browsable = yes
writable = yes
sudo chown -R your_username:your_username /path/to/shared/folder  # 赋予用户目录所有权
sudo systemctl restart smbd      # 重启Samba服务
smb://localhost/shared(或通过网络邻居访问),输入Ubuntu用户密码即可访问共享文件夹,实现大文件拖放传输。