如何在RED Hat Linux 防一用户两个人用登陆.
lnx3000 回复于:2003-07-18 14:50:32 |
什么意思? 我怎么看不懂 :) |
rinehart 回复于:2003-07-18 14:52:09 |
搂主的意思应该是,如何实现一个用户同一时间只能一个人使用 |
阿联 回复于:2003-07-18 14:53:08 |
防止一个用户名,两个人同时从不同的地方登陆. |
阿联 回复于:2003-07-18 19:21:45 |
有人帮帮我吗? |
Mada 回复于:2003-07-18 19:58:10 |
echo "* hard maxlogins 2" >> /etc/security/limits.conf Notes: This setting do not affact root account. |
flowerfox 回复于:2003-07-18 21:56:04 |
呵呵 |
阿联 回复于:2003-07-19 10:56:59 |
加在那呢? |
icedust 回复于:2003-07-19 14:11:53 |
[quote:7c1a5d9a3c="Mada"]echo "* hard maxlogins 2" >> /etc/security/limits.conf Notes: This setting do not affact root account.[/quote:7c1a5d9a3c] 照着打就行了? |
阿联 回复于:2003-07-19 14:17:21 |
写在那个文件里面. |
Mada 回复于:2003-07-19 14:37:50 |
直接在shell里面,就是你的命令行下面输入 echo "* hard maxlogins 2" >> /etc/security/limits.conf 然后回车,这个命令会将内容 * hard maxlogins 2 写到文件/etc/security/limits.conf中 |
阿联 回复于:2003-07-19 15:00:13 |
谢谢你. |
阿联 回复于:2003-07-19 15:24:30 |
但在终端上就没什么用了.还有别的办法吗? |
Mada 回复于:2003-07-19 15:48:01 |
还要防终端呀,那就继续 echo "session required pam_limits.so" >> /etc/pam.d/login |
webfox 回复于:2003-07-19 16:33:27 |
那么怎么可以防止在samba服务中一个用户名不能让他同时两个地方登陆呢? |
flying-dance big big pig 回复于:2003-07-19 16:57:19 |
[quote:8a64dba5c0="webfox"]那么怎么可以防止在samba服务中一个用户名不能让他同时两个地方登陆呢?[/quote:8a64dba5c0] 用pam认证把samba编译到mysql中就可以了~ |
webfox 回复于:2003-07-19 17:23:46 |
[quote:c3f77719fe="flying-dance big big pig"] 用pam认证把samba编译到mysql中就可以了~[/quote:c3f77719fe] 不知您能否详细地说一下怎么做? 谢谢. |
flying-dance big big pig 回复于:2003-07-19 17:45:16 |
[quote:aa8d8595dd="webfox"] 不知您能否详细地说一下怎么做? 谢谢.[/quote:aa8d8595dd] 测试环境RHlinux as 2.1 用了一昼测试成功 : ) step 1 configure mysql 插入一个root用户和test用户 设定passwd为“secretpw” insert the following SQL: CREATE DATABASE samba_auth; CREATE TABLE users ( uid int(6) NOT NULL auto_increment, gid int(6) DEFAULT '0' NOT NULL, last_name varchar(80) NOT NULL, first_name varchar(80) NOT NULL, login varchar(16) NOT NULL, date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, password varchar(16) NOT NULL, PRIMARY KEY (uid), KEY uid (uid), UNIQUE uid_2 (uid) ); INSERT INTO users VALUES ( '0', '0', 'account', 'root', 'root', 'NOW()', ENCRYPT('secretpw'), '', '', '', 'n', '', 'n', '', '0', '' ); INSERT INTO users VALUES ( '1', '1', 'account', 'test', 'test', 'NOW()', ENCRYPT('secretpw'), '', '', '', 'n', '', 'n', '', '0', '' ); step 2.configure pam pam_mysql 选项 user(nobody) -- The user with access to the open the connection to mysql and has permission to read the table with the passwords. passwd("") -- Password for the same. host(localhost) -- Machine that is running the sql server db(mysql) -- database that contents the table with the user/password combos table(user) -- table that you want to use for the user/password checking usercolumn(User) -- column that has the username field passwdcolumn(password) -- column that has the password field crypt=0:表示使用明文来存储密码, crypt=1:使用的DES加密密码方式来存储(cypt()相当于/etc/passwd or /etc/shadow) crypt=2:表示使用mysql的SQL函数password()加密方式来存储。PAM的文件: /usr/lib/libpam.so.* PAM核心库 /etc/pam.conf或者/etc/pam.d/ PAM配置文件 /usr/lib/security/pam_*.so 可动态加载的PAM service module 对于RedHat,其目录不是/usr/lib,而是/lib。 这里我使用cyrpt=1的认证机制~ 在/etc/pam.d/samba中加入 samba auth required pam_mysql.so user=root passwd=secretpw -> db=samba_auth table=users usercolumn=login crypt=1 samba account required pam_mysql.so user=root passwd=secretpw -> db=samba_auth table=users usercolumn=login crypt=1 samba password required pam_mysql.so user=root passwd=secretpw -> db=samba_auth table=users usercolumn=login crypt=1 samba session required pam_mysql.so user=root passwd=secretpw -> db=samba_auth table=users usercolumn=login crypt=1 使samba支持pam认证 Step 3: Configure Samba # Global parameters [global] workgroup = WORKGROUP-NAME server string = ppserver security = USER #must be set to 'no' to use PAM encrypt passwords = No update encrypted = No allow trusted domains = Yes min password length = 6 null passwords = No revalidate = No [homes] valid users = sample writeable = Yes [www] path = /www valid users = sample force group = http writeable = Yes [public] path = /samba/public valid users = sample writeable = Yes guest ok = No 用smbclient 测试一下 smbclient \\\\localhost\\sample 会提示你输入密码,input "secretpw"呵呵大功告成~ |
cuijiahui123 回复于:2005-05-05 21:39:03 |
楼主啊,你怎么看不懂啊,他写的是输入重定向吗,意思不是追加到/etc/security/limits.conf 这个文件里了吗,它的意思是限制最大登陆数为2,你仔细看就会看明白,我虽然没有试,但相信应该可以把.支持! |
风流涕淌 回复于:2005-06-23 15:59:11 |
收了,谢谢楼主 |
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/