sshd

通过配置hosts.allow和hosts.deny文件允许或禁止ssh或telnet操作

北慕城南 提交于 2019-12-24 15:15:53
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 通过配置hosts.allow和hosts.deny文件允许或禁止ssh或telnet操作 1、 登录主机, 如果是普通账户先 切换至root账号 su root 2 、 编缉/etc/ hosts.allow文件 vi /etc/hosts.allow 允许内容 书写格式(改成自自需要的IP或IP段) ssh允许单个ip sshd:192.168.220.1 ssh允许ip段 sshd:192.168.220. telnet允许单个ip in.telnetd:192.168.220.1 telnet允许ip段 in.telnetd:192.168.221. 以ssh允许192.168.220.1和telnet允许192.168.220网段为例,具体在/etc/hosts.allow加入内容如下: 3 、编辑 / etc/hosts.deny文件 vi /etc/hosts.deny 在文件中加入: sshd:ALL in.telnetd:ALL 具体在/etc/hosts.deny加入内容如下: 4、保存文件退出编缉后, 重启ssh服务 和 telnet服务 【 可选 】 service sshd restart service xinetd restart 说明: 1.一个IP请求连入

How to open a shell without SSHD on the receiving end?

浪子不回头ぞ 提交于 2019-12-23 02:32:15
问题 I have a machine without SSHD and I want to open a bash shell on this machine from a remote machine (that I can fully control). Since I have SSH on my limited machine, I configured a reverse proxy: $ ssh -R 19999:localhost:22 remoteuser@remotemachine Now I have a connection on port 19999 from my "fully control" machine to my "limited" machine. How would I open a shell with this setup? 回答1: You can pipe the input from some port directly to the bash . This is common practice when misusing

git clone without asking for users password

前提是你 提交于 2019-12-22 08:28:53
问题 I want to create public git repository on my dedicated server for anyone to clone but it keeps asking me for password for git user. I have created user named git without password. Used: passwd -d git Unfortunately every time I try to do: git clone git@myhost:myrepo.git I'm getting asked for password. I have tried setting in sshd_config Match user git PermitEmptyPasswords yes PasswordAuthentication yes With either yes and no for PasswordAuthentication but still no use. 回答1: It seems doing it

VPS如何设置拒绝被暴力登录

雨燕双飞 提交于 2019-12-22 01:07:02
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 本周登录vps速度非常慢,整个科学上网过程都很慢。 调查了一下,发现/var/log/secure文件大幅度增长,里面大量这种暴力攻击的log: Oct 25 11:41:07 vultr sshd[25755]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.229.172.103 user=root Oct 25 11:41:07 vultr sshd[25755]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root" Oct 25 11:41:08 vultr sshd[25755]: Failed password for root from 221.229.172.103 port 35405 ssh2 Oct 25 11:41:09 vultr sshd[25755]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root" Oct 25 11:41:11 vultr

linux系统管理-进程管理

拈花ヽ惹草 提交于 2019-12-21 00:15:14
目录 linux系统管理-进程管理 程序和进程的区别 进程的生命周期 进程状态管理命令(静态) 进程的相关命令 动态进程监控(top) 中断:硬中断 软中断: top命令的使用 信号管理进程(kill) linux系统管理-进程管理 程序和进程的区别 1.程序是数据和指令的集合,是一个静态的概念,比如/bin/ls、/bin/cp等二进制文件,同时程序可以长期存在系统中。 2.进程是一个程序的运行过程,是一个动态概念,进程是存在生命周期概念的,也就是说进程会随着程序的终止而销毁,不会永远在系统中存在。 进程的生命周期 程序运行是进程的状态关系 1.当父进程接收到任务调度时,会通过fork派生子进程来处理,那么子进程会集成父进程的衣钵。 2.子进程在处理任务代码时,父进程会进入等待的状态... 3.如果子进程在处理任务过程中,父进程退出了,子进程没有退出,那么这些子进程就没有父进程来管理了,就变成了僵尸进程。 4.每个进程都会有自己的PID号,(process id)子进程则PPID 进程状态管理命令(静态) 使用ps命令查看当前的进程状态(静态查看) 常用组合:ps aux 查看进程 [root@zls ~]# ps aux a:显示所有与终端相关的进程,由终端发起的 u:显示用户导向的用户列表 x:显示所有与终端无关的进程 在多任务处理操作系统中,每个CPU(或核心

vmware上虚拟机:Network error: Connection refused 排查

僤鯓⒐⒋嵵緔 提交于 2019-12-20 19:56:25
问题分析 vmware配置的fedora虚拟机, 主机能ping通虚拟机, 虚拟机也能ping通主机。但是用PUTTY连接虚拟机的时候出现 Network error: Connection refused。 排查方法 1、查看SSH服务有没有安装 #rpm -qa | grep ssh [root@localhost ~]# rpm -qa|grep ssh openssh-clients-6.1p1-4.fc18.i686 openssh-6.1p1-4.fc18.i686 libssh2-1.4.2-2.fc18.i686 openssh-server-6.1p1-4.fc18.i686 2、查看SSH服务有没有开启 #/bin/systemctl status sshd.service sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled) Active: active (running) since Wed, 2018-12-19 07:45:03 EST; 2h 1min ago Process: 687 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0

Centos安装后启动ssh服务

扶醉桌前 提交于 2019-12-20 17:54:03
安装好Centos后发现没有ip Centos显示ip 编辑/etc/sysconfig/network-scripts/ifcfg-ens33文件 修改ONBOOT属性为yes 保存退出 重启网卡:systemctl restart network 使用ifconfig命令查看ip信息 启动ssh服务 输入以下命令查看是否安装了openssh-server yum list installed | grep openssh-server 如果没有安装,则输入以下命令安装openssh-server yum install openssh-server 编辑/etc/ssh/sshd_config文件(注意不是ssh_config),查找并修改以下属性(去除’#’,即去除注释) Port 22 ListenAddress 0.0.0.0 ListenAddress :: PermitRootLogin yes PasswordAuthentication yes 开启sshd服务 sudo service sshd start 查看sshd服务是否启动 ps -e | grep sshd 来源: CSDN 作者: 仰天长笑笑长天 链接: https://blog.csdn.net/qq_37296487/article/details/103632629

SSH – Force Command execution on login even without Shell

瘦欲@ 提交于 2019-12-20 09:37:56
问题 I am creating a restricted user without shell for port forwarding only and I need to execute a script on login via pubkey, even if the user is connected via ssh -N user@host which doesn't asks SSH server for a shell. The script should warn admin on connections authenticated with pubkey, so the user connecting shouldn't be able to skip the execution of the script (e.g., by connecting with ssh -N ). I have tried to no avail: Setting the command at /etc/ssh/sshrc . Using command="COMMAND" in

云服务器简单ssh病毒屏蔽

笑着哭i 提交于 2019-12-20 08:08:42
本人搭建了阿里云和百度云,本以为平台会保证简单的网络安全,结果没人管,阿里云给的解决方案就是交钱升级为企业版或数据备份重置系统,坑爹。 现在云平台上各种挖矿病毒横行,几乎都是通过ssh服务植入病毒。阿里云几台不幸感染,重置了。根据个人斗争经验简单讲一下防护方法,今天只发只简单的,至于通过云平台配置安全组,略过不提。 查看本机的sshd记录 命令 : tail -100 /var/log/secure 查了一下IP,诸如香港、越南、荷兰、意大利、美国... 尼玛太多了,一个个屏蔽显然不可能。 一、打开hosts.allow, 命令 vi /etc/hosts.allow 添加允许sshd访问的公网IP,格式为 sshd: ipaddr 二、打开hosts.deny 命令 vi /etc/hosts.deny 禁止所有sshd 访问 格式为 sshd: ALL 因为allow的优先级要高于deny,所以不用担心允许访问的主机被禁。 来源: CSDN 作者: bigtiger1648 链接: https://blog.csdn.net/bigtiger1648/article/details/103616630

Ansible: insert a single word on an existing line in a file

一曲冷凌霜 提交于 2019-12-19 05:43:09
问题 I have to use Ansible modules in order to edit the /etc/ssh/sshd_config file - every time I create a new user I want to append it at these two lines: AllowUsers root osadmin <new_user> AllowGroups root staff <new_group> At this moment I'm using the shell module to execute a sed command but would like to use lineinfile, if possible - shell: "sed -i '/^Allow/ s/$/ {{ user_name }}/' /etc/ssh/sshd_config" Any suggestions would be sincerely appreciated. 回答1: You could do it in a single play with a