linux - Mac 无法访问端口 22
问题描述
总之,我无法连接到端口 22。要允许连接端口 22,我需要使用ufw
它来设置它,但我无法在我的机器上这样做。
我试图通过运行命令来连接服务器
ssh username@xx.xxx.xxx.xx
但我收到以下错误
ssh: connect to host username@xx.xxx.xxx.xx port 22: Operation timed out
我用谷歌搜索并发现问题与端口 22 连接有关,因此我按照建议尝试了以下命令。
sudo ufw allow 22/tcp
但我似乎需要先安装ufw
。我按照建议运行以下命令。
sudo apt-get install ufw
但似乎我需要安装apt-get
. 我试图安装它,但这篇文章说 Mac 只使用 Brew。https://stackoverflow.com/questions/5231160/sudo-apt-get-command-not-found
. 我尝试使用 brew ,但这就是我得到的。
brew install ufw
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "ufw".
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get its complete history, run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
我该如何解决这个问题?谢谢你。
解决方案
最终我发现问题与我的 VPN 有关。我无法使用我当前的 VPN 连接到端口。但是,我可以使用另一台计算机连接到该端口,因为它使用了正确的 VPN。
推荐阅读
- c# - 如何选择正确的错误消息记录策略
- android - 如何从 MutableLiveData 发出不同的值?
- javascript - 使用 Edge 浏览器时如何在网页中访问 localstorage?
- graphql - Nestjs GraphQL 查询未运行
- perl - 从哈希perl中的数组中获取唯一的值列表
- scala - 来自数组的结构类型
- php - wc_get_products 返回空数组?
- python - Python blocksize 大小混乱
- react-native - 调用时在键盘顶部添加一个按钮
- java - 如何使用类似于 addBatch() 但使用各种preparedStatements 对数据库执行不同的查询