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
 


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?
 
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.
 
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.
 
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
 

Members online


Top