0% found this document useful (0 votes)
62 views

Windows OpenSSH Linux Sshfs

The document discusses setting up SSH and SSHFS to securely share files between Windows and Linux systems. It shows how to install and configure OpenSSH on Windows to enable SFTP, and how to mount remote Windows and Linux directories on a CentOS system using SSHFS. Tests demonstrate copying files between the local and remote systems, allowing cross-OS file sharing and access.

Uploaded by

林志榮
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Windows OpenSSH Linux Sshfs

The document discusses setting up SSH and SSHFS to securely share files between Windows and Linux systems. It shows how to install and configure OpenSSH on Windows to enable SFTP, and how to mount remote Windows and Linux directories on a CentOS system using SSHFS. Tests demonstrate copying files between the local and remote systems, allowing cross-OS file sharing and access.

Uploaded by

林志榮
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

🪢

Windows OpenSSH + Linux sshfs


1. Windows 10 架設SFTP(SSH Server)
https://berglas.github.io/dest/articles/2020/7/note_SFTP_setting_1.html?fbclid=IwAR0lVvddEMcv3qld1QAkHvPSlrkQAkWE-
v2vsptBUwTEdHsUVyJOw7Tei1A

Windows OpenSSH + Linux sshfs 1


Windows OpenSSH + Linux sshfs 2
Windows OpenSSH + Linux sshfs 3
Windows OpenSSH + Linux sshfs 4
啟動
# SSH
Start-Service sshd

設定⾃動啟動
#
Set-Service -Name sshd -StartupType 'Automatic'


# firewall設定
Get-NetFirewallRule -Name *ssh*

Name : OpenSSH-Server-In-TCP
DisplayName : OpenSSH SSH Server (sshd)
Description : Inbound rule for OpenSSH SSH Server (sshd)
DisplayGroup : OpenSSH Server
Group : OpenSSH Server
Enabled : True
Profile : Any
Platform : {}
Direction : Inbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : 已從存放區成功剖析規則。 (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
RemoteDynamicKeywordAddresses :

如果沒有開
# 22 port ,⽤下⾯指令開啟
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort

Windows OpenSSH + Linux sshfs 5


2.測試連線 。Centos 連到 Windows
yum install epel-release
yum install fuse-sshfs
vi /etc/fuse.conf打凱 user_allow_other
user_allow_other

su - stevenlin

[stevenlin@centos7 ~]$ mkdir /home/stevenlin/win_user_soft


[stevenlin@centos7 ~]$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.43.27 netmask 255.255.255.0 broadcast 192.168.43.255
inet6 2001:b400:e20f:197:28d1:856e:818a:4040 prefixlen 64 scopeid 0x0<global>
inet6 fe80::6c28:eadd:bbc4:e650 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:3c:d8:d8 txqueuelen 1000 (Ethernet)
RX packets 8191 bytes 9454520 (9.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5202 bytes 475912 (464.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

# 透過SSHFS 把 windows 的⽬錄掛進 Centos 7


[stevenlin@centos7 ~]$ echo mkworld1632| sshfs -o reconnect,ServerAliveInterval=1,ServerAliveCountMax=5,StrictHostKeyChecking=no -o password
user@192.168.43.240's password:

[stevenlin@centos7 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 8.7M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/mapper/centos-root 50G 2.0G 49G 4% /
/dev/sda1 1014M 138M 877M 14% /boot
/dev/mapper/centos-home 46G 33M 46G 1% /home
tmpfs 396M 0 396M 0% /run/user/0
user@192.168.43.240:D:\software 316G 78G 238G 25% /home/stevenlin/win_user_soft

[stevenlin@centos7 ~]$ ll /home/stevenlin/win_user_soft/


total 8795504
-rw----rwx. 1 root root 4712300544 Mar 23 01:38 CentOS-7-x86_64-DVD-2009.iso
drwx---rwx. 1 root root 0 Mar 22 20:37 oracle_soft
-rwx---rwx. 1 root root 1225235 Jun 6 2019 setup-x86_64.exe
-rw----rwx. 1 root root 4293066752 Mar 12 2020 Windows.iso

# 解除連線
fusermount -u -z /home/stevenlin/win_user_soft

核對windows內的檔案

3.測試連線 。Centos 連到Centos

Windows OpenSSH + Linux sshfs 6


mkdir /home/stevenlin/linux_eric_doc
echo mkworld1632| sshfs -o reconnect,ServerAliveInterval=1,ServerAliveCountMax=5,StrictHostKeyChecking=no -o password_stdin -o allow_other e
[stevenlin@centos7 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 8.8M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/mapper/centos-root 50G 2.0G 49G 4% /
/dev/sda1 1014M 138M 877M 14% /boot
/dev/mapper/centos-home 46G 33M 46G 1% /home
tmpfs 396M 0 396M 0% /run/user/0
user@192.168.43.240:D:\software 316G 78G 238G 25% /home/stevenlin/win_user_soft
eric@192.168.43.171:/home/eric/doc 47G 33M 47G 1% /home/stevenlin/linux_eric_doc

4.測試遠端Server 跨OS。複製檔案。
[stevenlin@centos7 ~]$ cp ~/win_user_soft/setup-x86_64.exe ~/linux_eric_doc/
[stevenlin@centos7 ~]$ ls linux_eric_doc/
setup-x86_64.exe
[stevenlin@centos7 ~]$
[stevenlin@centos7 ~]$ cp ~/win_user_soft/setup-x86_64.exe ~/linux_eric_doc/
[stevenlin@centos7 ~]$ ls linux_eric_doc/
setup-x86_64.exe
[stevenlin@centos7 你好 我來⾃
~]$ echo ' , Linux' > ~/linux_eric_doc/linux_file.txt
[stevenlin@centos7 ~]$ cp ~/linux_eric_doc/linux_file.txt ~/win_user_soft/
[stevenlin@centos7 ~]$ ll ~/win_user_soft
total 8795512
-rw----rwx. 1 root root 0 Sep 6 23:44 aa
-rw----rwx. 1 root root 0 Sep 6 23:44 bb
-rw----rwx. 1 root root 4712300544 Mar 23 01:38 CentOS-7-x86_64-DVD-2009.iso
-rw----rwx. 1 root root 22 Sep 7 2022 linux_file.txt
drwx---rwx. 1 root root 4096 Mar 22 20:37 oracle_soft
-rwx---rwx. 1 root root 1225235 Jun 6 2019 setup-x86_64.exe
-rw----rwx. 1 root root 4293066752 Mar 12 2020 Windows.iso

Windows OpenSSH + Linux sshfs 7


Windows OpenSSH + Linux sshfs 8

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy