ssh

Linux基础优化与安全归纳总结

跟風遠走 提交于 2020-03-21 13:26:21
一名运维工程师在运维岗位上时间久了,就会发现Linux优化的重要性,同时会给运维工作带来很多的便利性。本人逐渐认识到了这一点,所以特意在工作闲暇之余,通过阅读Linux相关书籍及向同事、同行高手咨询,针对Linux系统的一些基本优化做了如下归纳总结,如有不足之处,还望大伙补充完善。 本文主要描述一些基本的系统优化知识点,并未涉及Linux深化优化,关于Linux的深化优化知识本人后期会更新。 第一点:Linux的管理尽量不用root用户,利用sudo命令来控制普通用户对系统的管理 新建一个用户,使用sudo命令添加权限,详细操作步骤如下: (1)添加新的用户: useradd 新的用户名 (2)检查是否已成功添加:id 新的用户名 (3)设置该用户的密码:echo 123321|passwd --stdin 新的用户名 接下来需将新的用户添加管理员权限,这个新的用户就相当于管理员 (4)备份之前的权限文件:\cp /etc/sudoers{,.back} (5)将新的用户添加管理员权限: echo "新的用户名 ALL=(ALL) NOPASSWD: ALL " >> /etc/sudoers (6)检查是否已成功添加:tail -1 /etc/sudoers (7)配置生效:visudo -c 待以上操作完毕,那么此时的新的用户权限等同于root用户。 第二点

ansible

我只是一个虾纸丫 提交于 2020-03-21 12:19:41
ansible Ansible : Ansible的核心程序 Host Lnventory : 记录了每一个由Ansible管理的主机信息,信息包括ssh端口,root帐号密码,ip地址等等。可以通过file来加载,可以通过CMDB加载 Playbooks : YAML格式文件,多个任务定义在一个文件中,使用时可以统一调用,“剧本”用来定义那些主机需要调用那些模块来完成的功能. Core Modules : Ansible执行任何管理任务都不是由Ansible自己完成,而是由核心模块完成;Ansible管理主机之前,先调用core Modules中的模块,然后指明管理Host Lnventory中的主机,就可以完成管理主机。 Custom Modules : 自定义模块,完成Ansible核心模块无法完成的功能,此模块支持任何语言编写。 Connection Plugins : 连接插件,Ansible和Host通信使用 ansible简介 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。 ansible是基于模块工作的,本身没有批量部署的能力。真正具有批量部署的是ansible所运行的模块,ansible只是提供一种框架

Unable to ssh using git config file

妖精的绣舞 提交于 2020-03-21 06:23:21
问题 I know its been asked so many times but i couldn't get answers for my problem. I am trying to ssh to system using config file. Config file is Host qa HostName 10.218.70.345 User user IdentityFile C:/Users/bean/.ssh/id_rsa.pub Port 22 When i run the below command $ ssh -v qa OpenSSH_8.0p1, OpenSSL 1.1.1c 28 May 2019 debug1: Reading configuration data /c/Users/bean/.ssh/config debug1: /c/Users/bean/.ssh/config line 1: Applying options for qa1 debug1: Reading configuration data /etc/ssh/ssh

How to pass in the password in scp using Java ssh JSch and jcabi-ssh

佐手、 提交于 2020-03-21 05:02:52
问题 I need to execute following command: scp -r ~/dataIn yatsuk@192.168.1.1:~/dataOut In ubuntu (16.04) terminal this command work correctly. yatsuk@192.168.1.1 is localhost. So I try this code using jcabi: Shell shell = new SSHByPassword("192.168.1.1", 22, "yatsuk", "passw"); String stdout = new Shell.Plain(shell).exec("scp -r ~/dataIn yatsuk@192.168.1.1:~/dataOut"); System.out.println(stdout); And this code by JSch: JSch jsch = new JSch(); JSch.setConfig("StrictHostKeyChecking", "no"); Session

Pushing commits to an SSH-cloned repo via VS Code on WSL returns “Host key verification failed” - it's ok on HTTPS

こ雲淡風輕ζ 提交于 2020-03-21 03:03:08
问题 I'm on a Windows 10 machine and I have both Git Bash and Ubuntu for Windows Subsystem for Linux (WSL) installed. When I use GitHub's official desktop app to clone a repo via HTTPS everything works fine and I can push my commits via Visual Studio Code with no problems whatsoever. I then try to clone a repo via SSH with Hyper (WSL Bash) and get this: The authenticity of host 'domain.com (a.b.c.d)' can't be established. RSA key fingerprint is XX:XX:...:XX. Are you sure you want to continue

Pushing commits to an SSH-cloned repo via VS Code on WSL returns “Host key verification failed” - it's ok on HTTPS

此生再无相见时 提交于 2020-03-21 03:02:40
问题 I'm on a Windows 10 machine and I have both Git Bash and Ubuntu for Windows Subsystem for Linux (WSL) installed. When I use GitHub's official desktop app to clone a repo via HTTPS everything works fine and I can push my commits via Visual Studio Code with no problems whatsoever. I then try to clone a repo via SSH with Hyper (WSL Bash) and get this: The authenticity of host 'domain.com (a.b.c.d)' can't be established. RSA key fingerprint is XX:XX:...:XX. Are you sure you want to continue

Pushing commits to an SSH-cloned repo via VS Code on WSL returns “Host key verification failed” - it's ok on HTTPS

主宰稳场 提交于 2020-03-21 03:02:06
问题 I'm on a Windows 10 machine and I have both Git Bash and Ubuntu for Windows Subsystem for Linux (WSL) installed. When I use GitHub's official desktop app to clone a repo via HTTPS everything works fine and I can push my commits via Visual Studio Code with no problems whatsoever. I then try to clone a repo via SSH with Hyper (WSL Bash) and get this: The authenticity of host 'domain.com (a.b.c.d)' can't be established. RSA key fingerprint is XX:XX:...:XX. Are you sure you want to continue

Linux-SSH

孤街醉人 提交于 2020-03-21 00:32:26
补2020.3.8 Linux-SSH SSH是一种能够以安全的方式提供远程登录的协议,也是目前远程管理Linux系统的首选方式。 注意 FTP或Telnet来进行远程登录,但是因为它们以明文的形式在网络中传输账户密码和数据信息,因此很不安全。 配置sshd服务 RHEL 7系统中,已经默认安装并启用了sshd服务程序。 ssh命令进行远程连接,其格式为 ssh [参数] 主机IP地址。 #一般配置文件格式为 /etc/服务名称/服务名称.conf 安全密钥认证 一般的口令或者明文输入形式存在安全隐患,使用密钥则更为保障。 使用ssh-keygen 来生成密钥对 将公钥上传后对服务器进行设置,仅能使用密钥进行验证 PasswordAuthentication no 不间断会话服务 运维传输超级实用!!! screen是一款能够实现多窗口远程控制的服务程序,可以使用screen服务程序同时在多个远程会话中自由切换。 能实现1.会话恢复 2.多窗口 3.会话共享 注意 在用-S创建会话窗口时候,闪烁一下已是进入了screen服务会话中了。 学习笔记: 来源: https://www.cnblogs.com/mrpanyue/p/12535775.html

SSH服务器拒绝了密码,请再试一次

随声附和 提交于 2020-03-20 23:21:02
使用Xshell连接ubuntu后,出现: SSH服务器拒绝了密码,请再试一次! 输入: cd /etc/ssh/ 继续: vim sshd_config 若此时提示没有安装vim,那我们安装以下: sudo apt-get install vim 安装成功后,重新输入: vim sshd_config 找到以下界面: # Authentication: LoginGraceTime 120 PermitRootLogin without-password StrictModes yes 修改为: # Authentication: LoginGraceTime 120 PermitRootLogin yes StrictModes yes 此时输入: :wq!保存并退出,若出现退出失败,此时按:q!(不保存退出)退出vim界面!我们可以换一种方式修改里面的参数!! 输入:sudo gedit /etc/ssh/sshd_config,在弹出来的文件夹修改,保存即可 然后重新连接xshell和虚拟机! 如果还是显示SSH服务器拒绝了密码,请再试一次! 那是因为你的用户名和密码输入错误导致的,这个问题整整折磨了我一下午啊!!! 切记用户名不是你想输什么,你就输什么,必须要和你ubuntu中的用户名一致,密码也不是你想设置什么就设置什么, 必须要和你进入ubuntu密码一致!!!否则

git+github

一世执手 提交于 2020-03-20 23:20:49
---------------------------------*********************** 下载,安装git ********************************************------------------ 网址:msysgit.github.io 安装:Use git from git bash only ... 其他:下一步 -----------------------**************************** 配置 ***************************--------------------------------------------- 1.配置path:   计算机--> 右键-->属性-->高级系统设置-->环境变量-->系统变量-->path   添加上git的地址(git到bin的路径eg:D:\Program Files (x86)\Git\bin) 2.配置git:   任意文件夹-->右键-->git bash   配置用户名和邮箱:   git config --global user.name "username"   git config --global user.email "3243243@qq.com"   查看是否成功   c盘-->用户--