`

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.
分享到:
评论

相关推荐

    SSH无密码登录配置(主要针对Hadoop配置)

    PermitRootLogin without-password ``` 如果允许root用户无密码登录,需设置`PermitRootLogin`为`without-password`。但出于安全考虑,一般不推荐直接用root用户进行SSH登录。 **五、重启SSH服务** 修改配置后,...

    Hadoop ubuntu 9.10 下的 SSH 免登陆

    4. **配置SSH**:编辑`/etc/ssh/sshd_config`文件,确保`PermitRootLogin`设置为`without-password`或`no`,以禁止root用户通过密码登录。同时,确认`PubkeyAuthentication`设置为`yes`,启用公钥认证。 5. **重启...

    ssh服务安装软件及其操作步骤.zip

    PermitRootLogin without-password PasswordAuthentication no PubkeyAuthentication yes ``` 接着,将公钥复制到嵌入式设备上,以实现无密码登录: ```bash ssh-copy-id -i ~/.ssh/id_rsa.pub root@device_ip ```...

    批量配置服务器ssh免密rsa登录

    6. **其他安全实践**:启用SSH的严格模式(`PubkeyAuthentication yes`和`PermitRootLogin without-password`),禁止密码登录,只允许公钥认证,以及设置防火墙规则限制SSH的访问端口和来源IP,都是增强SSH安全性的...

    SSH移植到android系统步骤.doc

    `PermitRootLogin without-password` `RSAAuthentication yes` `PubkeyAuthentication yes` `PasswordAuthentication no` 这样,我们就可以使用密钥登录Android系统了。 通过这篇文章,我们可以了解如何将OpenSSH...

    Ubuntu 16.04远程登录服务器ssh的安装和配置.pdf

    在 /etc/ssh/sshd_config 文件中,需要修改 Authentication 部分,注释掉“PermitRootLogin without-password”并添加“PermitRootLogin yes”: sudo vi /etc/ssh/sshd_config Authentication #PermitRootLogin ...

    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 ...

    FreeBSD 8.0 配置密钥登录

    - **PermitRootLogin**: 设置为`without-password`,表示root用户可以使用密钥认证登录,但不能使用密码登录。 下面是修改后的部分配置示例: ``` Protocol 2 RSAAuthentication yes PubkeyAuthentication ...

    openstack【juno】入门 【准备篇】一: Ubuntu14.04远程连接(ssh安装)

    在文件中,找到`PermitRootLogin without-password`这一行,添加一个`#`号,将其注释掉。接着,在文件末尾添加一行`PermitRootLogin yes`。这允许root用户使用密码登录,但为了安全,通常建议使用密钥对认证而非密码...

    linux下ssh服务器端的简单配置定义.pdf

    4. `PermitRootLogin without-password`: 允许root用户以无密码方式登录,这在生产环境中通常是不推荐的,因为它增加了被恶意攻击的风险。 5. `PasswordAuthentication yes`: 开启密码验证,允许用户通过密码登录。...

    ubuntu16.04服务器配置ssh免密码登录

    PermitRootLogin without-password ``` 修改后,记得保存并重启SSH服务以应用更改。 ```bash sudo service ssh restart ``` ### SSH简写技巧 创建一个`~/.ssh/config`文件,可以定义别名和配置,以简化SSH...

    ubuntu16.04安装ssh服务并实现远程访问的方法

    找到`PermitRootLogin`行,可能注释掉了或者设置为`without-password`,将其改为`yes`,如下所示: ``` PermitRootLogin yes ``` 保存并关闭文件后,需要重启SSH服务以应用新的配置: ```bash sudo systemctl ...

    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....

    毕业论文jsp1948电影院售票管理系统ssh.doc

    It ensures data security by implementing access control mechanisms, such as password authentication for administrators, ensuring that only authorized personnel can access sensitive information. ...

    ubuntu开启SSH服务远程登录操作的实现

    例如,若要禁止root用户密码登录,可以注释掉`PermitRootLogin without-password`行,并添加`PermitRootLogin no`。 6. **连接SSH**: 使用SSH命令进行远程登录,格式为`ssh username@hostname`,其中`username`是...

Global site tag (gtag.js) - Google Analytics