# Generate rsa key
ssh-keygen -b 2048
#or using
ssh-keygen -t rsa
# Copy public key to iPhone
scp ~/.ssh/id_rsa.pub root@iphone:~/.ssh/id_rsa.pub
# Add client public key to authorized_keys
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
# Test it out
ssh -i ~/.ssh/id_rsa root@iphone
# Then try it without `-i` option
ssh root@iphone
- If ssh agent failed, try to delete cached ssh key using
ssh-add -D
.
directory or file | permission |
---|---|
/home | 755 |
~/.ssh/* | 600 |
~/.ssh | 700 |