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用戶密碼即可訪問共享文件夾,實現大文件拖放傳輸。