0

I want to log in on a remote pc, example 10.10.10.5, from my local machine, called umar. the user on the remote machine is 'coolapp', so i want to pretty much do: ssh [email protected] and not enter a password but log in with public key. the problem is that on my local machine, i dont have a user 'coolapp'. how can i log in on the remote machine without having to first create a user 'coolapp' on my local machine and generating the ssh keys for it?

2
  • @BartDeVos i try to mark the correct answers as accepted, and have more than 50% accepted answers on stackoverflow, but on serverfault, the problem is that i post a question, sometimes the answers dont work out so i cannot mark any as acccepted, then i later either solve the problem myself, or do a workaround, or it is still unsolved but does not bug me anymore. if i do a workaround, then my pc configuration changes, and even if someone answers it later, i cannot use the answer and hence cannot accept any as i wont know if it works or not. in programming, it is easy to return toananswerlater..
    – umar
    Nov 23, 2011 at 12:40
  • @BartDeVos and mark as accepted, or post ur own answer, but here, if my pc configuration changes, or i solve it myself and forget the solution later on, i cannot come back to mark answers as accepted. after ur comment i checked my profile, and there was a question about sshing between two laptops. now i dont have that same problem as i dont have another laptop, so i dont know how to check answers and mark as accepted the right answer. may be later when i know more, i can revisit the answers and mark some as accepted, thanks for pointing it out to me.
    – umar
    Nov 23, 2011 at 12:42

2 Answers 2

3

try on your local machine

ssh-copy-id [email protected]

if you didnt create your key then before ssh-copy-id you must execute

ssh-keygen

then

ssh [email protected]

1
  • ur answer answers the problem completely without explaining how it solves the problem. the one on top explains without answering it completely. so i am still thinking which answer to mark as accepted ...
    – umar
    Nov 22, 2011 at 13:58
4

You are mixing a few things up here. You do not need to have the same user name across systems to be able to log in on remote systems.

Make sure to put your key on the remote server (public part), and on your local machine (private part) (and check the rights). Then you should be able to login with:

ssh [email protected]    

without being asked for a password (unless you have a key that needs to be unlocked).

Your private key should be in ~/.ssh/id_rsa. Make sure the right are set properly:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa 

Your public should be at ~/.ssh/authorized_keys and have the following rights applied:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Finally, go and check in /etc/ssh/sshd_config if keys are allowed to be used.

3
  • i know that, when i enter ssh [email protected], it asks for a password, which i enter and i am logged in. however, i want to log in without needing a password. i am logged in as another user, 'umar' on my local machine, so that there is no coolapp user on my local machine
    – umar
    Nov 22, 2011 at 13:17
  • 1
    If he still asks you for a password, you probably have made an error. Check the rights and location of the keys and check if your ssh-config allows for keys to be used. I've updated my answer. Nov 22, 2011 at 13:26
  • thanks for the detailed answer, i actuall learnt from serverfault.com/questions/114388/… that i dont need to have the same user on my local machine, i just need to 'tell' the remote machine that my machine is authorized to access the remote machine as user 'a' by copying local machine's public key to remoteuser@remotemachine's .ssh/authorized_keys file
    – umar
    Nov 22, 2011 at 13:49

You must log in to answer this question.

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