普通用户su 到root,无需密码方式,及iptables封掉本机某个端口,core文件配置
一. 普通用户su到root无需密码:
随着服务器越来越多,普通用户转到root下,去查密码表是个很繁琐的事,发现有如下方式比较方便(需要root操作)
vi /etc/pam.d/su
将 auth这一列的注释号 去除
# Uncomment the following line to implicitly trust users in the "wheel" group.
auth sufficient pam_wheel.so trust use_uid
然后将登陆用户加入 wheel组
usermod -G wheel $username (gpasswd -a $username wheel)
这样从$username su 到root就无需密码了。
将某个用户从wheel组中删除:gpasswd -d $username wheel
二. iptables封掉本机某个端口:
查看本机iptables设置情况: iptables -L -n
封掉本机(本机ip:hostname -i获取,假设本机ip为:192.168.68.32)8888端口input: iptables -A INPUT -d 192.168.68.32 -p tcp --dport 8888 -j DROP
封掉本机(本机ip:hostname -i获取,假设本机ip为:192.168.68.32)8888端口output: iptables -A OUTPUT -d 192.168.68.32 -p tcp --dport 8888 -j DROP
清除预设表filter中的所有规则链的规则: iptables -F
清除预设表filter中使用者自定链中的规则: iptables -X
三. core文件配置:
1.core文件的生成开关和大小限制
---------------------------------
1) 使用ulimit -c命令可查看core文件的生成开关。若结果为0,则表示关闭了此功能,不会生成core文件。
) 使用ulimit -cfilesize命令,可以限制core文件的大小(filesize的单位为kbyte)。若ulimit -cunlimited,则表示core文件的大小不受限制。如果生成的信息超过此大小,将会被裁剪,最终生成一个不完整的core文件。在调试此 core文件的时候,gdb会提示错误。
在用户的~/.bash_profile里加上ulimit -c unlimited来让特定的用户能产生core文件,而ulimit -c 1024 可以设置core文件大小
2.core文件的名称和生成路径
----------------------------
若系统生成的core文件不带其它任何扩展名称,则全部命名为core。新的core文件生成将覆盖原来的core文件。
,表示添加pid作为扩展名,生成的core文件格式为core.xxxx;为0则表示生成的core文件同一命名为core。
可通过以下命令修改此文件:
echo "1" > /proc/sys/kernel/core_uses_pid
)proc/sys/kernel/core_pattern可以控制core文件保存位置和文件名格式。
可通过以下命令修改此文件:
echo "/corefile/core-%e-%p-%t" > core_pattern,可以将core文件统一生成到/corefile目录下,产生的文件名为core-命令名-pid-时间戳
以下是参数列表:
%p - insert pid into filename 添加pid
%u - insert current uid into filename 添加当前uid
%g - insert current gid into filename 添加当前gid
%s - insert signal that caused the coredump into the filename 添加导致产生core的信号
%t - insert UNIX time that the coredump occurred into filename 添加core文件生成时的unix时间
%h - insert hostname where the coredump happened into filename 添加主机名
%e - insert coredumping executable name into filename 添加命令名
普通用户su 到root,无需密码方式,及iptables封掉本机某个端口,core文件配置的更多相关文章
- Linux安全加固(二)禁止普通用户su到root/设置SSH终端接入白名单/修改history条数
一.禁止普通用户su到root管理员.设置可以su到root的白名单 1.首先看一下正常情况 2.可以看到普通用户使用su root命令,输入密码即可登录到root用户 3.下面开始配置禁止所有普通用 ...
- Linux禁止普通用户su至root
linux系统为了限制权限,有时候需要禁止普通用户su到root用户 为禁止普通用户su至root,需要分别修改/etc/pam.d/su和/etc/login.defs两个配置文件. 二.详细配置 ...
- Linux进入单用户模式(passwd root修改密码)
进入单用户模式——passwd root修改密码 1.在grub 页面输入a,进入修改内核模式 2.在内核的结尾“/”,输入空格,在输入single,回车 3.启动系统,进入单用户模式 4.Passw ...
- centOS禁止普通用户su到root
1.关于su的相关权限涉及到两个文件,分别为/etc/pam.d/su和/etc/login.defs两个配置文件. 2.禁止普通用户su到root,配置如下: 去除/etc/pam.d/su文件中如 ...
- Linux 禁止普通用户su到root
Linux账户权限管理上为了防止普通用户通过su切换到root用户,需要修改/etc/pam.d/su和/etc/login.defs两个配置文件. Step1:修改 /etc/pam.d/su文件 ...
- linux 普通用户切换成root免密码
[root@ok ~]# vim /etc/pam.d/su 下面是/etc/pam.d/su文件的内容 #%PAM-1.0 auth sufficient pam_rootok.so # Uncom ...
- 检查是否使用PAM认证模块禁止wheel组之外的用户su为root
编辑su文件(vi /etc/pam.d/su),在开头添加下面两行: auth sufficient pam_rootok.so 和 auth required pam_wheel.so group ...
- CentOS 7 / RHEL 7 运行单用户模式进行root的密码重置
步骤一,开机时随便按下键盘,进入以下菜单 步骤二: 选择第一项,按e键进行修改 步骤三,定位到 ro( linux 16 or linuxefi ) 步骤四:把ro改成 “rw init=/sys ...
- centos7用户管理及root忘记密码恢复
查看用户相关命令:#id 用户和组的信息#whoami #查看当前有效用户名#who #显示目前登入系统的用户信息.#w # w 命令用于显示已经登陆系统的用户列表#users #用于显示当前登录系统 ...
随机推荐
- CSS 杂记
1. z-index: img{ position:absolute; left:0px; top:0px; z-index:-1;} 所有主流浏览器都支持 z-index 属性. 注释:任何的版本的 ...
- LoadRunner Controller: 压力机
前提条件 1. 压力机所在的机器上装了LR agent ,并启用了. 运行下图所示程序,即可启动.启动之后状态栏会出现卫星小图标 2. Controller所在机器的RPC服务开启. 打开运行 –&g ...
- ubuntu server vsftpd 虚拟用户及目录
ubuntu server vsftpd 虚拟用户及目录 一:需求场景: 在ubuntu server上开设一个虚拟网站,在网站目录建立一个ftp目录,允许用户通过ftp上传网站文件到网站目录: 同时 ...
- npm之使用淘宝源
暂时使用: npm --registry https://registry.npm.taobao.org i express 永久使用: npm conf set registry https://r ...
- tail 命令(转)
原文:http://www.cnblogs.com/peida/archive/2012/11/07/2758084.html ail 命令从指定点开始将文件写到标准输出.使用tail命令的-f选项可 ...
- JS模板语言不错的脚本
<html> <script src="template.js"></script> <head> </head> &l ...
- 1z0-052 q209_4
4: You have two tables with referential integrity enforced between them. You need to insert data to ...
- lftp mirror 上传目录
1. lftp的确很强大, 要学习一下. sudo yum install lftp (测试了一下,ftp软件才92K,lftp有2.3M) 2. lftp mirror 能上 ...
- TCP Socket 粘包
这两天看csdn有一些关于socket粘包,socket缓冲区设置的问题.发现自己不是非常清楚,所以查资料了解记录一下: 一两个简单概念长连接与短连接: 1.长连接 Client方与Server ...
- c:forEach标签
//varStat代表 遍历typeListDesc集合所用到的方法 <!-- stat当前迭代的第几项 --> <c:forEach var="type" it ...