Saturday, February 20, 2010

SCP & SSH

At local machine:
ssh-keygen -t rsa
cd ~/.ssh
cp id_rsa.pub authorized_keys
scp -p ~/.ssh/authorized_keys username@remoteMachine:.ssh/

Note that before executing scp you need to make sure there is ~/.ssh at remote machine also and create it if neccecery with
mkdir ~/.ssh

At remote machine:
cd
ls -ld . .ssh .ssh/authorized_keys
drwxr-xr-x 36 username username 4096 Jul 25 02:24 .
drwxr-xr-x 2 username username 512 Apr 10 02:30 .ssh
-rw-r--r-- 1 username username 1674 Apr 10 02:29 .ssh/authorized_keys

cd
chmod go-w . .ssh .ssh/authorized_keys

At local machine:
scp -p file username@remoteMachine:path/to/file

Reference:
http://kimmo.suominen.com/docs/ssh/

No comments: