From 63ec405e0ee0dc5ea89ee921d9ce845566f45912 Mon Sep 17 00:00:00 2001 From: Rodney Osodo Date: Fri, 1 Nov 2024 09:44:31 +0300 Subject: [PATCH 1/2] feat: enable ssh on hal Signed-off-by: Rodney Osodo --- hal/buildroot/linux/configs/cube_defconfig | 7 +++++++ hal/buildroot/qemu.sh | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hal/buildroot/linux/configs/cube_defconfig b/hal/buildroot/linux/configs/cube_defconfig index 21cb2d1..801d045 100644 --- a/hal/buildroot/linux/configs/cube_defconfig +++ b/hal/buildroot/linux/configs/cube_defconfig @@ -82,3 +82,10 @@ BR2_TARGET_GENERIC_ROOT_PASSWD="m2N2Lfno" BR2_PACKAGE_HOST_MKPASSWD=y BR2_PACKAGE_HTOP=y + +# SSH +BR2_PACKAGE_OPENSSH=y +BR2_PACKAGE_OPENSSH_CLIENT=y +BR2_PACKAGE_OPENSSH_SERVER=y +BR2_PACKAGE_OPENSSH_KEY_UTILS=y +BR2_PACKAGE_OPENSSH_SANDBOX=y diff --git a/hal/buildroot/qemu.sh b/hal/buildroot/qemu.sh index 8eff9d5..22f426a 100644 --- a/hal/buildroot/qemu.sh +++ b/hal/buildroot/qemu.sh @@ -47,7 +47,7 @@ function start_qemu(){ -cpu $CPU_TYPE \ -machine q35 \ -enable-kvm \ - -netdev user,id=vmnic,hostfwd=tcp::6191-:80,hostfwd=tcp::6192-:443,hostfwd=tcp::6193-:3001,dns=8.8.8.8 \ + -netdev user,id=vmnic,hostfwd=tcp::6190-:22,hostfwd=tcp::6191-:80,hostfwd=tcp::6192-:443,hostfwd=tcp::6193-:3001,dns=8.8.8.8 \ -device virtio-net-pci,disable-legacy=on,iommu_platform=true,netdev=vmnic,romfile= \ -nographic \ -no-reboot \ @@ -74,7 +74,7 @@ function start_cvm(){ -cpu $CPU_TYPE \ -machine q35 \ -enable-kvm \ - -netdev user,id=vmnic,hostfwd=tcp::6191-:80,hostfwd=tcp::6192-:443,hostfwd=tcp::6193-:3001,dns=8.8.8.8 \ + -netdev user,id=vmnic,hostfwd=tcp::6190-:22,hostfwd=tcp::6191-:80,hostfwd=tcp::6192-:443,hostfwd=tcp::6193-:3001,dns=8.8.8.8 \ -device virtio-net-pci,disable-legacy=on,iommu_platform=true,netdev=vmnic,romfile= \ -nographic \ -no-reboot \ From 352d16cec548e3c1cd4569d68c1e1d84d800fdce Mon Sep 17 00:00:00 2001 From: Rodney Osodo Date: Fri, 1 Nov 2024 10:34:43 +0300 Subject: [PATCH 2/2] docs(ssh): Document how to copy files to vm Add documentation that disable root login or create a user so as to copy files into the vm Signed-off-by: Rodney Osodo --- hal/buildroot/ssh.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 hal/buildroot/ssh.md diff --git a/hal/buildroot/ssh.md b/hal/buildroot/ssh.md new file mode 100644 index 0000000..8d02bef --- /dev/null +++ b/hal/buildroot/ssh.md @@ -0,0 +1,43 @@ +# SSH Configuration For Cube AI + +## Overview + +Cube AI uses a SSH to enable remote access to the VM. By default, the SSH server does not allow root login. You can either enable root login or create a new user with a specific password. This also allows you to copy files to the VM. + +## Add new user + +```bash +adduser --gecos "[your name]" --shell /bin/bash +``` + +For example: + +```bash +adduser --gecos "Rodney Osodo" --shell /bin/bash rodneyosodo +``` + +## Enable SSH root login + +Edit the `/etc/ssh/sshd_config` file and add the following line: + +```bash +PermitRootLogin yes +``` + +Save the file and restart the SSH server: + +```bash +systemctl restart sshd +``` + +## To copy files to the VM + +```bash +scp -P 6190 @: +``` + +For example: + +```bash +scp -P 6190 test.txt rodneyosodo@localhost:/home/rodneyosodo +```