首页 > 其他分享 >enable sshd in WSL

enable sshd in WSL

时间:2023-08-07 21:34:49浏览次数:24  
标签:bin sshd enable WSL systemctl usr ssh

正常安装 openssh-server:

sudo yum install -y openssh-server

WSL 中的特殊配置:

mv /usr/bin/systemctl /usr/bin/systemctl.old
curl https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py > /usr/bin/systemctl
chmod +x /usr/bin/systemctl
systemctl enable sshd
# 很可能显示失败
systemctl status sshd

# 手动执行 sshd 服务会报错
/sbin/sshd -f /etc/ssh/sshd_config

会报这种错:

Could not load host key: /etc/ssh/ssh_host_rsa_key

解决方法是手动生成:

ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key

最后,重启:

service sshd restart

标签:bin,sshd,enable,WSL,systemctl,usr,ssh
From: https://www.cnblogs.com/lddcool/p/17612760.html

相关文章

  • WSL2下不能使用gdb.attach的解决方案
    安装tmux用root权限安装sudoapt-getinstalltmux进入根目录cd~编辑配置使用root权限打开tmux,方便保存配置文件sudotmux新建.tmux.conf文件vim.tmux.conf在文件中输入#输入bind-keycnew-window-c"#{pane_current_path}"bind-key%split-window-h-......
  • Wslg Debian系统安装Fcitx5 输入法,和配置
    Debian配置Fcitx5输入法sudoaptinstallfcitx5fcitx5-rime放到~/.profile的配置exportLC_CTYPE="zh_CN.UTF-8"exportGTK_IM_MODULE=fcitxexportQT_IM_MODULE=fcitxexportXMODIFIERS=@im=fcitxexportSDL_IM_MODULE=fcitxexportXIM=fcitx#配置了这个,就可以在e......
  • wsl
    安装配置官方教程https://learn.microsoft.com/zh-cn/windows/wsl/install安装默认安装ubuntuwsl--install查看可安装系统wsl-l-o或wsl--list--online安装其他系统wsl--install-dDebian进入装完后,以普通用户身份进入wsl以root用户身份进入wsl-uro......
  • wsl2中R语言使用注意事项
    wsl2中R语言使用注意事项1.在archlinux中使用命令sudopacman-Sr安装R语言2.使用部分安装包的时候会报错fortran相关库缺失,可以使用命令sudopacman-Sgcc-fortran安装相应的库3.当初次运行install.package()的时候会调用chooseCranMirror()函数,这个函数会调用本机的图形接......
  • WSL 常见操作
    WSL数据迁移:wsl--shutdown#关机wsl--exportUbuntu-20.04E:\WSL-Ubuntu-20.04#导出数据到文件wsl--unregisterUbuntu-20.04#注销原来的发行版wsl--importUbuntu-20.04E:\WSL-Ubuntu\E:\wsl-Ubuntu-20.04--version2#导入数据ubuntu2004config--defa......
  • [SpringBoot] Not registered via @EnableConfigurationPropertise or marked as Spri
    问题描述在Springboot进行参数绑定时,出现解决添加以下依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </depende......
  • 基于wsl2在container中利用conda安装pytorch环境
    ###一、利用conda创建一个新的环境参考命令condacreate-nENV_NAMEpython=X.X•-nENV_NAME指定环境名称•python=X.X指定要创建的Python版本,比如python=3.6使用命令:condacreate-npytorch1.13python=3.8参考资料-Anacondaconda常用命令:从入门到精通:https://......
  • 2023.07 WSL2 CentOS 使用桥接网卡固定IP/加入局域网
    WSL2CentOS使用桥接网卡固定IP/加入局域网参考资料https://zhuanlan.zhihu.com/p/593263088https://www.cnblogs.com/lic0914/p/17003251.html进入Hyper-V管理器新建桥接网卡进入%USERPROFILE%目录新建.wslconfig文件[wsl2]vmIdleTimeout=-1networkingMo......
  • 基于VScode的wsl2的conda使用
    一、安装conda环境(基于docker的)1.1MicroSoft对于wsl2和docker的官方解释:https://learn.microsoft.com/en-us/windows/wsl/use-custom-distro1.2对于docker和wsl2原理解析:https://zhuanlan.zhihu.com/p/4817409141.3安装完docker环境和container环境后直接在VScode中......
  • linux终止进程案例:踢掉非法登录用户 | 关闭sshd | 杀死终端
    摘要目的:举例linux杀死进程的使用一、踢掉某个非法登录用户要求:假设tom通过ssh非法登录了,需要踢掉这个用户1.查找tom对应的sshd下面两个都可以ps-ef|grepsshdps-aux|grepsshd可以看到进程号是19342.踢掉tomkill1934//tom的sshd的进程号二、终止远程登......