Score:0

OpenSSH permission denied (public key)

cn flag

I am currently trying to configure an ssh server that uses key-based authentication instead of a password login. I am required to disable the following: AllowTCPForwarding, GatewayPorts, PermitRootLogin, HostbasedAuthentication, PermitEmptyPasswords, and X11Forwarding.

I have followed many tutorials on how to do this, however, when I try to log on to the SSH server I am greeted with

Permission denied (publickey).

I have already created the key using ssh-keygen -t rsa -b 4096 and copied it to ~/.ssh/authorized_keys on the SSH server, as well as enabled PubKeyAuthentication and restarted the server.

Any help would be greatly appreciated!

uz flag
Jos
Use `ssh` with multiple `-v` flags to get a (very) verbose description of what is happening between client and server. At the very least, this will give you the relevant error message.
Score:0
tr flag

You need to specify on the client side which key to use.

You can do this either with ssh -i PATH_TO_PRIVATE_KEY, or via a configuration file, the latter being much more convenient.

Here's an excerpt from my ~/.ssh/config which applies to github:

Host github github.com
    HostName github.com
    User git
    PasswordAuthentication no
    IdentityFile ~/.ssh/github.shaggyrogers.rsa

Note that words immediately following Host are the hostnames (as entered on the command line) that the configuration block applies to. In this case, I can simply type ssh github or ssh github.com. See man ssh_config for more information.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.