Passwordless scp

amarjeet

New Member
Joined
Jun 17, 2022
Messages
2
Reaction score
0
Credits
22
Hey There,
I am configuring passwordless authentication:
1. Created a public key using ssh-keygen -t rsa
I have got 2 file id_rsa and id_rsa.pub
2. We can copy this id_rsa.pub to remote server to execute passwordless authentication, that's right.
3.Also, we can copy this id_rsa.pub to local server aswell under different user and passwordless authentication will work from one user to other.
4.But, if the username is same as well, in that case how to get it work. i.e
source and destination host and user both are same.

Is it necessary to have different user or different hot???

Any immediate response will be highly appreciable.

Thanks,
Amarjeet
 


osprey

Member
Joined
Apr 15, 2022
Messages
78
Reaction score
43
Credits
680
To disable password and only use key for authentication did you
change the config in /etc/ssh/ssh_config on remote host to:
PasswordAuthentication No
and then run #systemctl reload sshd --- to give effect to changes?
 

Rob

Administrator
Staff member
Joined
Oct 27, 2011
Messages
914
Reaction score
1,728
Credits
1,123
You can have same users on both local and remote if you like.. doesn't matter at all. The important part is that the .pub file goes on the servers that you're attempting to log into and the non .pub file stays safely on your local machine.
 
OP
A

amarjeet

New Member
Joined
Jun 17, 2022
Messages
2
Reaction score
0
Credits
22
To disable password and only use key for authentication did you
change the config in /etc/ssh/ssh_config on remote host to:
PasswordAuthentication No
and then run #systemctl reload sshd --- to give effect to changes?
Thanks osprey, but as i mentioned there is no remote host, source and destination host both are same, and username is same aswell.
1655709778872.png


as you can see above i am trying to connect to same host using same username.
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,776
Reaction score
3,433
Credits
34,774
Why would u
Thanks osprey, but as i mentioned there is no remote host, source and destination host both are same, and username is same aswell. as you can see above i am trying to connect to same host using same username.
Why would you use scp to copy files over from one location on the host to another location on the same host, scp is used to copy files over a network. it's easier just to use rsync since it can do both local and remote, for example from the rsync man page.
Code:
 rsync -av /src/foo /dest
 rsync -av /src/foo/ /dest/foo
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top