VirtualBox中端口映射archlinux ssh

1.配置Pacman并安装ssh
vim /etc/pacman.d/mirrorlist
Server = http://mirrors.163.com/archlinux/$repo/os/i686 (163的镜像地址)

#pacman -Sy 将本地的包数据库与远程的仓库进行同步

#pacman -S openssh

vim /etc/rc.conf

DAEMONS=(... sshd ...) 在其中添加ssh 服务器开机启动

2.配置VirtualBox端口映射

Oracle公司在最新的3.2版本中,VirtualBox简化了端口映射的步骤,只要一条命令就可以了。

VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"

3.配置archlinux ssh

#
# /etc/hosts.allow
#
#sshd: ALL: ALLOW                 # 这一行设置是允许所有的IP登录,不推荐。
sshd: 10.0.2.2: ALLOW    # 允许10.0.2.2登录。
# End of file

另外,openssh默认也是不允许root帐户直接登录的,需要修改/etc/ssh/sshd_config文件将PermitRootLogin yes前的#号去掉就可以了。

原文地址:https://www.cnblogs.com/storymedia/p/4436149.html