how to copy a file to another file in separate directories?
So I have created to vm's with the ubuntu 16.04 version. I'm trying to copy my public key into the authorized_keys file, how I have done this is with the command cp id_rsa.pub home/vagrant/.ssh/
I done the command from the home/deploy/.ssh/ directory but I get the following error: cp: cannot create regular file 'home/vagrant/.ssh/': No such file or directory
. Can anyone tell me why I'm getting this error.
Thank you for the help in advance.
Solution 1:
The command fails because you need a forward slash at the start of the path, like this:
cp id_rsa.pub /home/vagrant/.ssh/
In order to actually use the key, you can add the key to authorized_keys
with this command:
cat id_rsa.pub >> /home/vagrant/.ssh/authorized_keys