`

SSH Without a Password

阅读更多


The following steps can be used to ssh from one system to another without specifying a password.

Notes:

  • The system from which the ssh session is started via the ssh command is the client .
  • The system that the ssh session connects to is the server .
  • These steps seem to work on systems running OpenSSH .
  • The steps assume that a DSA key is being used. To use a RSA key substitute 'rsa' for 'dsa'.
  • The steps assume that you are using a Bourne-like shell (sh, ksh or bash )
  • Some of this information came from:
    http://www.der-keiler.de/Mailing-Lists/securityfocus/Secure_Shell/2002-12/0083.html

Steps:

  1. On the client run the following commands:

    $ mkdir -p $HOME/.ssh
    $ chmod 0700 $HOME/.ssh
    $ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''
    
    This should result in two files, $HOME/.ssh/id_dsa (private key) and $HOME/.ssh/id_dsa.pub (public key).
  2. Copy $HOME/.ssh/id_dsa.pub to the server .

  3. On the server run the following commands:

    $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys2
    $ chmod 0600 $HOME/.ssh/authorized_keys2
    
    Depending on the version of OpenSSH the following commands may also be required:
    $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys
    $ chmod 0600 $HOME/.ssh/authorized_keys
    
    An alternative is to create a link from authorized_keys2 to authorized_keys:
    $ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys
    
  4. On the client test the results by ssh'ing to the server :

    $ ssh  server
    
    
    
  5. (Optional) Add the following $HOME/.ssh/config on the client :

    Host server
    
    
             IdentityFile ~/.ssh/id_dsa
    
    This allows ssh access to the server without having to specify the path to the id_dsa file as an argument to ssh each time.
分享到:
评论

相关推荐

    openssh-server -Ubuntu18.04远程服务离线安装包

    依次运行下面命令进行安装: sudo dpkg -i openssh-client_1%3a7.6p1-4ubuntu0.6_amd64.deb sudo dpkg -i ncurses-term_6.1-1ubuntu1.18.04_all.deb ... 删除permitRootLogin后面的without-password后改为yes

    配置Docker容器ssh服务端实现远程ssh登录

    #此步骤主要目的是修改sshd_config配置文件,把配置文件中的”PermitRootLogin without-password”加一个”#”号,把它注释掉,再增加一句”PermitRootLogin yes”,参考:https://www.jianshu.com/p/adda91b7c1d2 ...

    linuxdeploy-2.1.0-237.apk

    The recommended minimum size of a disk image is 1024 MB (with LXDE), and without a GUI - 512 MB. When you install Linux on the flash card with the FAT32 file system, the image size should not exceed ...

    openssh-7.1p2.tar.gz

    prohibit-password/without-password that could, depending on compile-time configuration, permit password authentication to root while preventing other forms of authentication. This problem was ...

    How to use SFTP

    You can optionally enter your key's passphrase (which is advisable – otherwise the converted key will be saved without a passphrase, which is insecure). Then via Conversions -> Export OpenSSH ...

    Re-SyncMysqlMasterSlaveReplication:如何重置(重新同步)MySQL 主从复制

    此工具必须在主服务器上运行ssh 访问两台服务器(主从) 使用 ssh 从主服务器到从属服务器的 ssh 访问(谷歌:ssh without password) 在这一点上有一些帮助。 使用 ssh 以您要使用的帐户名登录到您的服务器。 提示...

    谷歌云服务器设置多服务器间ssh免登录连接(ubantu 18.04)

    PermitRootLogin without-password 改为 PermitRootLogin yes 重启ssh服务:sudo service sshd restart 密码设置:sudo passwd user-name 然后设置各个主机的映射 sudo vim /etc/hosts 192.168.128.128 Master 192....

    Linux Shell Scripting Cookbook

    Table of Contents Preface 1 Chapter 1: Shell Something Out 7 Introduction 7 Printing in the terminal 9 ...Password-less auto-login with SSH 253 Running commands on remote host with SSH 255

    a project model for the FreeBSD Project.7z

    A project model for the FreeBSD Project Niklas Saers Copyright © 2002-2005 Niklas Saers [ Split HTML / Single HTML ] Table of Contents Foreword 1 Overview 2 Definitions 2.1. Activity 2.2. Process ...

    BSD HACKS -- 100个业界最尖端的技巧和工具

    Access Windows Shares Without a Server Section 20. Deal with Disk Hogs Section 21. Manage Temporary Files and Swap Space Section 22. Recreate a Directory Structure Using mtree Section...

    计算机网络第六版答案

    Computer Networking: A Top-Down Approach, 6th Edition Solutions to Review Questions and Problems Version Date: May 2012 This document contains the solutions to review questions and problems...

    UE(官方下载)

    A tutorial for UltraEdit/UEStudio's SSH/telent feature Adding a wordfile Adding a wordfile in UltraEdit v15.00 and greater Adding a wordfile (in v14.20 and earlier) Add a language definition to your ...

    pyloris-3.2-win32

    Using HTTPLoris is simple. In its most basic form, HTTPLoris merely needs a copy of Python 2.6. ...Optionally, one may set a username and password for the SOCKS proxy using these two flags.

    Vmware下Ubuntu server版安装图文教程

    本文为大家分享了Ubuntu server版安装图文教程,供大家参考,具体内容如下 ...找到PermitRootLogin without-password一行,改为PermitRootLogin yes 6. 重启 openssh server $ sudo service ssh restart 7. xshe

Global site tag (gtag.js) - Google Analytics