Skip to content

Instantly share code, notes, and snippets.

@nageshshamnur
Last active December 20, 2019 09:12
Show Gist options
  • Save nageshshamnur/65e418b66d9c7232d945d35112f72296 to your computer and use it in GitHub Desktop.
Save nageshshamnur/65e418b66d9c7232d945d35112f72296 to your computer and use it in GitHub Desktop.
OP-TEE: Enabling SSH on QEMU Guest and connecting to guest from HOST
OP-TEE project provides only one UART for CA. However for any purpose if need more than one terminal,
then this blog will help in addressing this issue.
I had to collect information from multiple forums. Ofcouse thanks to jerome Forissier from his input, this wouldn't
have been possible.
I hope this will help other members who wants a similar solution.
1) Enable the SSH service for QEMU. Edit the file common.mk which is present under the build folder(optee_project/build) to add the following 2 lines:
@echo "BR2_PACKAGE_OPENSSH=y" >> ../out-br/extra.conf
@echo "BR2_PACKAGE_AUTOSSH=y" >> ../out-br/extra.conf
2) when compiling QEMU, need to enable the port which will be used to connect to SSH daemon on qemu guest:
,hostfwd=tcp::2222-:22
output:
cd /home/Nagesh/TEE/optee_project/build/../out/bin && /home/Nagesh/TEE/optee_project/build/../qemu/arm-softmmu/qemu-system-arm \
-nographic \
-serial tcp:localhost:54320 -serial tcp:localhost:54321 \
-smp 2 \
-s -S -machine virt,secure=on -cpu cortex-a15 \
-d unimp -semihosting-config enable,target=native \
-m 1057 \
-bios bl1.bin \
-fsdev local,id=fsdev0,path=/home/Nagesh/TEE/optee_project/build/..,security_model=none -device virtio-9p-device,fsdev=fsdev0,mount_tag=host -netdev user,id=vmnic,hostfwd=tcp::12345-:12345,hostfwd=tcp::2222-:22 -device virtio-net-device,netdev=vmnic
3) once login to guest, do the following changes there:
vi /etc/ssh/sshd_config
PermitRootLogin yes
PermitEmptyPasswords yes
4) Restart SSH Daemon
/etc/init.d/S50sshd restart
5) Generate new set of keys for this SSH service on guest:
/usr/bin/ssh-keygen -A
/usr/sbin/sshd
touch /var/lock/sshd
6) Now connect to this QEMU guest daemon from host using the following command:
ssh root@localhost -p 2222
references:
https://unix.stackexchange.com/questions/124681/how-to-ssh-from-host-to-guest-using-qemu
https://stackoverflow.com/questions/1556056/permission-denied-publickey-keyboard-interactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment