zoukankan      html  css  js  c++  java
  • 【Linux】Xshell 配置密钥登陆

    设置不需要密码登陆

    vim /etc/ssh/sshd_config

    在配置文件中参数的意义

     PubkeyAuthentication yes    #启用公告密钥配对认证方式 
     AuthorizedKeysFile  %h/.ssh/authorized_keys    #设定PublicKey文件路径
     RSAAuthentication yes  #允许RSA密钥
     PasswordAuthentication no #禁止密码验证登录,如果启用的话,RSA认证登录就没有意义了
     #禁用root账户登录,非必要,但为了安全性,请配置
     PermitRootLogin no

    如果需要密码就可以ssh登陆的话,将PasswordAuthentication  设置为yes

    然后重启ssh 服务 进入到  /etc/init.d 文件夹内 执行 ./ssh restart

    =====================================

    如何设置可以往linux传文件:

    1:用户授权,或者设置为root用户

    2:设置为root用户需要设置root用户可以通过ssh原创登陆

    #编辑
    vi /etc/ssh/sshd_config
    #LoginGraceTime 2m
    #PermitRootLogin prohibit-password
    PermitRootLogin yes  #这里设置为yes
    #StrictModes yes
    #MaxAuthTries 6
    #MaxSessions 10

    然后:重启ssh服务: /etc/init.d/ssh restart   //这一步重要

    ps:ubuntu 初始化没有激活root用户的,下面就是激活root用户的操作

    ubtun默认是没有激活root用户密码的:

    sudo passwd root 或者 sudo passwd

    然后输入当前用户密码

    在输入root账户密码

    确认密码

    su root 切换到root账户,输入设置密码

    ====================给用户提升为root权限===========

    1:编辑passwd文件

    sudo vim /etc/passwd

    2:找到你想提权的用户(比如test),将用户名后面的数字改成0

    pollinate:x:111:1::/var/cache/pollinate:/bin/false
    flwroot:x:0:0:,,,:/home/flwroot:/bin/bash #这里改为0:0

    ====================创建新用户===========

  • 相关阅读:
    【NOIP模拟】寻找
    【NOIP模拟】行走
    【UVA11795】 Mega Man's Mission
    【UVA11825】Hackers' Crackdown
    【UVA1252】Twenty Questions
    BZOJ1718: [Usaco2006 Jan] Redundant Paths 分离的路径
    BZOJ1151: [CTSC2007]动物园zoo
    BZOJ1123: [POI2008]BLO
    BZOJ1040: [ZJOI2008]骑士
    POJ3417:Network
  • 原文地址:https://www.cnblogs.com/simple-flw/p/12927542.html
Copyright © 2011-2022 走看看