0

I started a guest vm with

qemu-system-x86_64 -net user -net nic -redir tcp:10022::22 -m 500 -hda op.img

From the guest, I'm able to ssh the host machine, but can't connect via sftp The command I use for ssh is

ssh -R 10022:localhost:22 [email protected]

Tried to play with sftp -oBindAddress and also -P, but with no success.

2
  • 1
    What happens if you try sftp? What error messages do you get? What's the tracec from sftp -vvv? What ssh daemon are you running inside the guest, does it include sftp-server? Commented Feb 3, 2012 at 23:05
  • @Gilles, the guest is an OpenBSD system. In sshd_config, sftp seems to be working as a Subsystem sftp /usr/libexec/sftp-server (same line as in host sshd_config. Maybe I'm not issuing the correct command, but can't find out how: $ sftp -vvv -oBindAddress=21222 [email protected] OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011 debug1: Reading configuration data /home/user/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug2: ssh_connect: needpriv 0 debug1: Connecting to 10.0.2.2 [10.0.2.2] port 22. Couldn't read packet: Connection reset by peer
    – Luis
    Commented Feb 4, 2012 at 16:41

1 Answer 1

1

If you can ssh to it, you can sftp to it. It's the same port right? You can check it with a tcpdump on your interfaces, you will see the "sftp" command making noise on your guest.

Go deeper by looking in your log files (/var/log/) especially /var/log/auth.log with tail -f while you are trying to log in.

I don't get why you are using this command to connect via ssh to your guest. What you are doing is telling ssh to listen and forward traffic arriving on your guest's port 10022 to 127.0.0.1 port 22.

Just do:

ssh [email protected]

assuming 10.0.2.2 is your VM. To use sftp just do:

sftp [email protected]

If the first works and not the second, it's a configuration problem, I guess. Provide us with more input if the problem persists.

2
  • from <alien.slackbook.org/dokuwiki/doku.php?id=slackware:qemu>, QEMU will act as a firewall between guest OS and the host computer, so that no network communication is possible from any host program to the guest OS. For instance, you will not be able to setup a ssh session to the guest.
    – Luis
    Commented Feb 4, 2012 at 17:02
  • using sftp on the port 10022 doesn't work? I didn't really focus on the user mode and redir, but just on the issue making ssh working and sftp not working. You are able to ssh from the guest to the host but not use sftp, which is really not normal assuming an openssh-server running with the default configuration. Sorry I got messed up in my answer, and I'll let someone else carry on since I can't be of much help.
    – Aki
    Commented Feb 4, 2012 at 19:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .