Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 user@10.0.2.2

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

share|improve this question
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? –  Gilles Feb 3 '12 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 user@10.0.2.2 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 Feb 4 '12 at 16:41
add comment

1 Answer

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 user@10.0.2.2

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

sftp user@10.0.2.2

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

share|improve this answer
    
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 Feb 4 '12 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 Feb 4 '12 at 19:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.