LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1480|回复: 6

How to use /etc/pam.d/reboot to limit "only root user on local machin

[复制链接]
发表于 2005-10-31 22:58:47 | 显示全部楼层 |阅读模式
I am readin Miaechl Jiang's RHCE Study Guide, in Chapter 10, it talks about /etc/pam.d/reboot:

*****************************************************************
To demonstrate how control flags work, take a look at the commands from the
/etc/pam.d/reboot configuration file:

auth sufficient pam_rootok.so

The first auth command checks the pam_rootok.so module. If the root user runs thereboot command, the control_flag is sufficient, the other auth commands in this file are ignored. Linux runs the reboot command. ..

auth required pam_console.so

The second auth command is run only for nonroot users; it just governs the console parameters at the command line interface. ...

#auth required pam_stack.so service=system-auth

The third line is commented out by default. If you make this line active, it refers to the system-auth configuration file, which requires root user privileges. Remote users who know your root password are still allowed to reboot your computer.

account required pam_permit.so

The module associated with the account command (pam_permit.so) accepts all users, even those who’ve logged in remotely. In other words, this configuration file would allow any root user, local or remote, to reboot your Linux computer.

Alternatively, you might add the pam_securetty.so module, which would keep remote users from rebooting your system.

************************************************************
I tried many tests, but still can't limit only root user on LOCAL machine can reboot... Here is one example I have tried:

auth required pam_rootok.so
auth required pam_securetty.so
auth required pam_console.so
auth required pam_stack.so service=system-auth
account required pam_permit.so

Any clue?? Thanks a lot.....
发表于 2005-11-1 02:32:43 | 显示全部楼层
configure your securetty file, block root user from login remotely.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-1 04:30:21 | 显示全部楼层
yongjian, I beg you for more details

You said:
"configure your securetty file, block root user from login remotely."

I am not sure what do you mean.

1. If there is /etc/securetty file, root can't login remotely; but you can su to root by first loging as non root file.

2. If you want to even block su to root, use /etc/pam.d/su,  uncomment this line (by default, only root is in wheel group).

# Uncomment the following line to require a user to be in the "wheel" group.
#auth       required     /lib/security/$ISA/pam_wheel.so use_uid

However,
3. What I want to do is:  
there is /etc/securetty file, root can't login remotely, but can su.
Then I don't want to root to be able to REBOOT remotely...

I know this actually sounds weird: if root can su remotely, he can then change everything

So maybe we can't block root from reboot remotely if root is allowed to login remotely (directly or su)???
回复 支持 反对

使用道具 举报

发表于 2005-11-1 08:39:07 | 显示全部楼层
you got it, no matter what, if a user can get to root shell, he/she is able to reboot the box.
回复 支持 反对

使用道具 举报

发表于 2005-11-6 19:02:43 | 显示全部楼层
Just need to remove /etc/security/console.app/reboot
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-7 06:01:35 | 显示全部楼层
Thanks for the reply...

I tried to remove /etc/security/console.apps/reboot, but still doesn't work: root user, as long as he can login remotely, he can reboot remotely.
回复 支持 反对

使用道具 举报

发表于 2005-11-7 22:07:03 | 显示全部楼层
Oh , sorry
I mean that
on local machine only root can  reboot
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表