Its quite easy to set up keys following a tutorial as this. But once you have it generated, it could be quite a hassle to do all the required steps on every machine you need to access. Especially if you find your self having to access many machines, often with more than one user.
Anyways, here's a nice bash-function to set up your keys for you.
  function remember_me {
    ssh $1 'mkdir -p .ssh && touch .ssh/authorized_keys \
    && chmod 0700 .ssh \
    && chmod 0600 .ssh/authorized_keys \
    && cat >> .ssh/authorized_keys' <~/.ssh/id_rsa.pub
  }
  source ~/.bashrc
  remember_me youruser@your.domain.com
On the subject; an other related tip is to setup your servers as aliases adding something like
  alias server="ssh youruser@your.domain.com"
If you set up the ssh-keys correctly you just have to type
  server
 
 
 
 Posts
Posts
 
 

No comments:
Post a Comment