藍森林首頁 | 返回主頁 | 本站地圖 | 站內搜索 | 聯繫信箱 |
 您目前的位置:首頁 > 自由軟件 > 技術交流 > 系統管理


    

藍森林 http://www.lslnet.com 2006年8月18日 15:18


如何在RED Hat Linux 防一用戶兩個人用登陸.

如何在RED  Hat Linux 防一用戶兩個人用登陸.

如何在RED Hat Linux 防一用戶兩個人用登陸.

什麼意思? 我怎麼看不懂 :)

如何在RED Hat Linux 防一用戶兩個人用登陸.

摟主的意思應該是,如何實現一個用戶同一時間只能一個人使用

如何在RED Hat Linux 防一用戶兩個人用登陸.

防止一個用戶名,兩個人同時從不同的地方登陸.

如何在RED Hat Linux 防一用戶兩個人用登陸.

有人幫幫我嗎?

如何在RED Hat Linux 防一用戶兩個人用登陸.

echo "*       hard    maxlogins       2" >;>; /etc/security/limits.conf     

Notes: This setting do not affact root account.

如何在RED Hat Linux 防一用戶兩個人用登陸.

呵呵

如何在RED Hat Linux 防一用戶兩個人用登陸.

加在那呢?

如何在RED Hat Linux 防一用戶兩個人用登陸.

-->     

照著打就行了?

如何在RED Hat Linux 防一用戶兩個人用登陸.

寫在那個文件裡面.

如何在RED Hat Linux 防一用戶兩個人用登陸.

直接在shell裡面,就是你的命令行下面輸入
echo "* hard maxlogins 2" >;>; /etc/security/limits.conf
然後回車,這個命令會將內容
* hard maxlogins 2
寫到文件/etc/security/limits.conf中

如何在RED Hat Linux 防一用戶兩個人用登陸.

謝謝你.

如何在RED Hat Linux 防一用戶兩個人用登陸.

但在終端上就沒什麼用了.還有別的辦法嗎?

如何在RED Hat Linux 防一用戶兩個人用登陸.

還要防終端呀,那就繼續

echo "session required pam_limits.so" >;>; /etc/pam.d/login

如何在RED Hat Linux 防一用戶兩個人用登陸.

那麼怎麼可以防止在samba服務中一個用戶名不能讓他同時兩個地方登陸呢?

如何在RED Hat Linux 防一用戶兩個人用登陸.

如何在RED Hat Linux 防一用戶兩個人用登陸.

-->     

不知您能否詳細地說一下怎麼做?
謝謝.

如何在RED Hat Linux 防一用戶兩個人用登陸.

-->     

測試環境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"呵呵大功告成∼

如何在RED Hat Linux 防一用戶兩個人用登陸.

樓主啊,你怎麼看不懂啊,他寫的是輸入重定向嗎,意思不是追加到/etc/security/limits.conf 這個文件裡了嗎,它的意思是限制最大登陸數為2,你仔細看就會看明白,我雖然沒有試,但相信應該可以把.支持!

如何在RED Hat Linux 防一用戶兩個人用登陸.

收了,謝謝樓主



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 藍森林網站 版權所有。 E-mail : webmaster@lslnet.com