Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For development tests, I need to setup an SFTP server. So I want to know if it's possible to use the same machine as the client and the server. I tried and I keep getting this error:

Permission denied (publickey).
Connection closed
share|improve this question

migrated from stackoverflow.com Apr 21 '10 at 10:30

This question came from our site for professional and enthusiast programmers.

3 Answers 3

The short answer:

cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
share|improve this answer
    
i'm on windows machine, i already copied the public key into authorized_keys but still no result –  achraf Apr 21 '10 at 10:07
    
when a question needs to be on SU or SF, please don't mention it in an answer. post that in a comment to the question instead. when/if the question (with your answer) gets migrated, we won't have to clean up the question. thanks! –  quack quixote Apr 21 '10 at 11:03
    
Can your Windows ssh client do the equivalent of ssh -v in Unix clients, showing verbose messages about what it's doing? My first guess is that it's a permissions problem for your key files, that they're either too secure for the ssh server to see, or too loose that the server thinks other users could tamper with them. –  coneslayer Apr 21 '10 at 11:15

[thecoshman] I'm under Windows XP, I'm using OpenSSH and to perform test I just use the command prompt.

[coneslayer] the command: ssh -v returns

C:\Program Files\OpenSSH\bin>ssh -v agharroud@localhost OpenSSH_3.8.1p1,OpenSSL 0.9.7d 17 Mar 2004`
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established. debug1: identity file /home/agharroud/.ssh/identity type -1 debug1: identity file /home/agharroud/.ssh/id_rsa type 1
debug1: identity file /home/agharroud/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_3.8.1p1
debug1: match: OpenSSH_3.8.1p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex:server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'localhost' is known and matches the RSA host key.
debug1: Found key in /home/agharroud/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received

                        ****USAGE WARNING****

This is a private computer system. This computer system, including all related equipment, networks, and network devices (specifically including Internet access) are provided only for authorized use. This computer system may be monitored for all lawful purposes, including to ensure that its use is authorized, for management of the system, to facilitate protection against unauthorized access, and to verify security procedures, survivability, and operational security. Monitoring includes active attacks by authorized entities to test or verify the security of this system. During monitoring, information may be examined, recorded, copied and used for authorized purposes. All information, including personal information, placed or sent over this system may be monitored.

Use of this computer system, authorized or unauthorized, constitutes consent to monitoring of this system. Unauthorized use may subject you to criminal prosecution. Evidence of unauthorized use collected during monitoring may be used for administrative, criminal, or other adverse action. Use of this system constitutes consent to monitoring for these purposes.

debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key:/home/agharroud/.ssh/identity
debug1: Offering public key:/home/agharroud/.ssh/id_rsa
debug1:Authentications that can continue:publickey
debug1: Trying private key:/home/agharroud/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

share|improve this answer
    
You still need to supply your normal arguments with ssh -v, for example ssh -v username@hostname. (Also, the etiquette here would be to edit your question with the additional information, instead of posting it as an answer.) –  coneslayer Apr 21 '10 at 12:09
    
any ideas about what can be the problem ? –  achraf Apr 26 '10 at 13:25

It's not clear if your question is specific about client=server or if you cannot deploy an sftp server at all.

You should check:

  • Can you ssh to this machine with your username from another machine in first place?
  • Have you installed and launched an ssh server yet?
  • Is your username authorized to login in the ssh server configurations?
  • Do you have firewalls enabled? Try disabling just for a test.

In linux I do it all the time, even when I just want to run a graphical application logged as another user but inside my desktop session:

ssh [-X] [-A] [etc] username@localhost

(Replace "username" by the name you will use to connect to the machine. Do not replace localhost, it's really meant to be called "localhost".)

I guess if you cannot even do ssh username@localhost you won't manage to perfom self sftp.

share|improve this answer

Your Answer

 
discard

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