• Linux命令:ssh-copy-id


    ssh-copy-id帮助

     1 SSH-COPY-ID(1)                                                                BSD General Commands Manual                                                                SSH-COPY-ID(1)
     2 
     3 NAME
     4      ssh-copy-id — use locally available keys to authorise logins on a remote machine
     5 
     6 SYNOPSIS
     7      ssh-copy-id [-f] [-n] [-i [identity_file]] [-p port] [-o ssh_option] [user@]hostname
     8      ssh-copy-id -h | -?
     9 
    10 DESCRIPTION
    11      ssh-copy-id is a script that uses ssh(1) to log into a remote machine (presumably using a login password, so password authentication should be enabled, unless you've done some
    12      clever use of multiple identities).  It assembles a list of one or more fingerprints (as described below) and tries to log in with each key, to see if any of them are already
    13      installed (of course, if you are not using ssh-agent(1) this may result in you being repeatedly prompted for pass-phrases).  It then assembles a list of those that failed to log
    14      in, and using ssh, enables logins with those keys on the remote server.  By default it adds the keys by appending them to the remote user's ~/.ssh/authorized_keys (creating the
    15      file, and directory, if necessary).  It is also capable of detecting if the remote system is a NetScreen, and using its ‘set ssh pka-dsa key ...’ command instead.
    16 
    17      The options are as follows:
    18 
    19      -i identity_file
    20              Use only the key(s) contained in identity_file (rather than looking for identities via ssh-add(1) or in the default_ID_file).  If the filename does not end in .pub this
    21              is added.  If the filename is omitted, the default_ID_file is used.
    22 
    23              Note that this can be used to ensure that the keys copied have the comment one prefers and/or extra options applied, by ensuring that the key file has these set as pre‐
    24              ferred before the copy is attempted.
    25 
    26      -f      Forced mode: doesn't check if the keys are present on the remote server.  This means that it does not need the private key.  Of course, this can result in more than one
    27              copy of the key being installed on the remote system.
    28 
    29      -n      do a dry-run.  Instead of installing keys on the remote system simply prints the key(s) that would have been installed.
    30 
    31      -h, -?  Print Usage summary
    32 
    33      -p port, -o ssh_option
    34              These two options are simply passed through untouched, along with their argument, to allow one to set the port or other ssh(1) options, respectively.
    35 
    36              Rather than specifying these as command line options, it is often better to use (per-host) settings in ssh(1)'s configuration file: ssh_config(5).
    37 
    38      Default behaviour without -i, is to check ifssh-add -L’ provides any output, and if so those keys are used.  Note that this results in the comment on the key being the filename
    39      that was given to ssh-add(1) when the key was loaded into your ssh-agent(1) rather than the comment contained in that file, which is a bit of a shame.  Otherwise, if ssh-add(1)
    40      provides no keys contents of the default_ID_file will be used.
    41 
    42      The default_ID_file is the most recent file that matches: ~/.ssh/id*.pub, (excluding those that match ~/.ssh/*-cert.pub) so if you create a key that is not the one you want
    43      ssh-copy-id to use, just use touch(1) on your preferred key's .pub file to reinstate it as the most recent.
    44 
    45 EXAMPLES
    46      If you have already installed keys from one system on a lot of remote hosts, and you then create a new key, on a new client machine, say, it can be difficult to keep track of
    47      which systems on which you've installed the new key.  One way of dealing with this is to load both the new key and old key(s) into your ssh-agent(1).  Load the new key first,
    48      without the -c option, then load one or more old keys into the agent, possibly by ssh-ing to the client machine that has that old key, using the -A option to allow agent forward‐
    49      ing:
    50 
    51            user@newclient$ ssh-add
    52            user@newclient$ ssh -A old.client
    53            user@oldl$ ssh-add -c
    54            ... prompt for pass-phrase ...
    55            user@old$ logoff
    56            user@newclient$ ssh someserver
    57 
    58      now, if the new key is installed on the server, you'll be allowed in unprompted, whereas if you only have the old key(s) enabled, you'll be asked for confirmation, which is your
    59      cue to log back out and run
    60 
    61            user@newclient$ ssh-copy-id -i someserver
    62 
    63      The reason you might want to specify the -i option in this case is to ensure that the comment on the installed key is the one from the .pub file, rather than just the filename
    64      that was loaded into you agent.  It also ensures that only the id you intended is installed, rather than all the keys that you have in your ssh-agent(1).  Of course, you can
    65      specify another id, or use the contents of the ssh-agent(1) as you prefer.
    66 
    67      Having mentioned ssh-add(1)'s -c option, you might consider using this whenever using agent forwarding to avoid your key being hijacked, but it is much better to instead use
    68      ssh(1)'s ProxyCommand and -W option, to bounce through remote servers while always doing direct end-to-end authentication. This way the middle hop(s) don't get access to your
    69      ssh-agent(1).  A web search for ‘ssh proxycommand nc’ should prove enlightening (N.B. the modern approach is to use the -W option, rather than nc(1)).
    70 
    71 ENVIRONMENT
    72      SSH_COPY_ID_LEGACY
    73              If the SSH_COPY_ID_LEGACY environment variable is set, the ssh-copy-id is run in a legacy mode. In this mode, the ssh-copy-id doesn't check an existence of a private key
    74              and doesn't do remote checks of the remote server versions or if public keys are already installed.
    75 
    76 SEE ALSO
    77      ssh(1), ssh-agent(1), sshd(8)
    78 
    79 BSD                                                                                  March 15, 2019                                                                                 BSD
    View Code
    本篇文章出自“国民时代”,转载请注明转载出处。
  • 相关阅读:
    一般查找 (顺序查找)
    sscanf
    uva-11044-水题
    uva-10785-模拟水题
    uva-10596-欧拉回路
    uva-10879-因数分解
    uva-10562-二叉树
    扯皮的cplex-感觉时间不对
    cplex-Java-样例代码解析
    cplexJava源码---计算结果
  • 原文地址:https://www.cnblogs.com/ChinaGo/p/10537342.html
Copyright © 2020-2023  润新知