LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 05-15-2020, 09:43 AM   #1
DeanAnderson
LQ Newbie
 
Registered: Nov 2019
Posts: 19

Rep: Reputation: Disabled
ssh keygen copy between 2 PC where logins are different - does it make sense?


Hi
I have ssh keygen generated on one PC which looks something like that:

Code:
ssh-rsa BDFdasadsdsds
ssadffdsfdsfdssdfds
dsds/sdsdssasaasasa
ssassad my_login1@something.net
I have on this PC ./ssh/known_hosts list fulfilled as PC has been used for a few years.
Then I have another second new PC2. Unfortunately I made mistake on another PC2 - when I was installing ubuntu I created another login than on first PC, let's say it is my_login2. However I will try to add second login to PC2 called my_login with root privelages. If I succeed the question is:

Can I copy now keygen and known_hosts from first PC to second PC2 and will it work? The important thing is also that part after @ is different. On PC1 it is something.net and on PC2 it is somethingother.net. Despite this fact will it work?

Another problem is that it is not so easy to create second account on PC2 with root privelages. I created with command:
sudo usermod -aG sudo my_login
and I have many issues, for example:
ls /media/sf_shared
ls: cannot open directory '/media/sf_shared': Permission denied

Last edited by DeanAnderson; 05-15-2020 at 10:00 AM.
 
Old 05-15-2020, 10:00 AM   #2
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
I may be misunderstanding your question...
For example, you have:
userA on PC1
userB on PC2

You can copy content of public key (file that ends in .pub) into authorized_keys file.

This will allow password-less login to work between users and PCs.
 
Old 05-15-2020, 10:02 AM   #3
DeanAnderson
LQ Newbie
 
Registered: Nov 2019
Posts: 19

Original Poster
Rep: Reputation: Disabled
OK I thought that logins have to be the same.
I will try just when they are different and let's see if it works.

Comment:
It doesn't work. This login is important. I got:

Code:
my_login2@something.net:~/work$ git clone -b folder ssh://gerrit.someaddress:port/somepath
Cloning into 'folder'...
my_login2@gerrit.someaddress: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
The problem is with login. It have to be my_login. What my alternatives are?
- install ubuntu system from the beginning now with proper login the same as on first PC and in keygen - a lot of work
- generate new keygen and add it to tens of servers gitlab, gerrit - I would like to avoid this one as a lot of work
- create second account on PC2 with proper login, but there are a lot of problem with lack of access for example to /media/sf_shared
- any better idea? Keep in mind that I use also bitbake so any modification to this command (explicity set login) can't be done:
git clone -b folder ssh://gerrit.someaddressort/somepath
as this is how bitbake use it without explicity set login.

Last edited by DeanAnderson; 05-15-2020 at 10:42 AM.
 
Old 05-15-2020, 10:40 AM   #4
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Just try simple SSH first:

Code:
ssh <username>@<hostname>
 
Old 05-15-2020, 10:42 AM   #5
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
If the username is different, then you will have to specify that:

Code:
git clone -b folder ssh://<username>@gerrit.someaddress:port/somepath
 
Old 05-15-2020, 12:41 PM   #6
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,733

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
AFAIK, ssh keys identify computers and users. They aren't transferable. One needs a key for each user and 'puter.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ssh-Keygen copy error murphyola General 2 10-03-2019 08:05 AM
LXer: Using scponly To Allow SCP/SFTP Logins And Disable SSH Logins On Debian Squeeze LXer Syndicated Linux News 0 08-24-2011 04:20 AM
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
Current: sense key: No Sense Dready359 Linux - Hardware 2 03-20-2008 08:56 AM
kernel: st0: Error with sense data: Current st09:00: sense key N da_kidd_er Linux - Hardware 0 12-16-2004 10:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 01:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration