WSL windows子系统 Ubuntu 20.04 更新apt为国内源

开启SSH远程访问

去掉下面的注释,并修改

Port 22
ListenAddress 127.0.0.1
PasswordAuthentication yes

ssh 访问, ssh name@127.0.0.1
建议修改root密码, 使用密码免得每次都要加sudo

重启ssh服务: service ssh restart

修改apt源

备份 cp /etc/apt/sources.list /etc/apt/sources.list.bak

清空并修改 vi /etc/apt/sources.list

附:阿里源

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

上述ssh 重启时 可能会报错:

sshd: no hostkeys available -- exiting

可以执行这个

ssh-keygen -A

或者按我执行的这个:

sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
# 回车 
sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
相关文章
添加新评论
取消评论
*
*
*
勇士!消灭0条评论,这么艰巨的任务就靠你了!