2011/07/07

GNOME Keyring & Auto-login

What the hell is GNOME Keyring, anyway?

GNOME Keyring is a service and API used by GNOME programs to securely store various secrets, such as email or WiFi passwords.

See the GnomeKeyring page on GNOME Live.

Why am I being asked to unlock a "keyring"?

When you login normally, the system gives the password you just entered to gnome-keyring, which then unlocks the login keyring.

When you have auto-login enabled, you don't enter any password, and gnome-keyring cannot unlock the keyring automatically. So it asks you to unlock it.

If you want to have auto-login and auto-unlock, you need to remove the keyring's password (set it to a blank one). This won't be a security risk, as you already have automatic login.

Changing the keyring password

Run the keyring manager seahorse (or Applications > Accessories > Passwords and Encryption keys if you use GNOME). Then open the Passwords tab. (Depending on Seahorse's version, it might be the first or the last tab.)


Now find the login keyring, right-click on it, and choose Change Password. Enter your old password into the Old password box, but leave the other two blank.


When asked about "unsafe storage", confirm.

Now the passwordless keyring will be unlocked automatically.
But I have autologin disabled and it still doesn't work!

First, make sure your login and keyring passwords are exactly the same.

Then check if PAM is configured correctly. Look for lines containing pam_gnome_keyring.so in /etc/pam.d/:

# snipped
auth optional pam_gnome_keyring.so
session optional pam_gnome_keyring.so auto_start

On most distros, those lines usually go to /etc/pam.d/gdm for GDM (graphical login), and /etc/pam.d/login for tty login. The GnomeKeyring/Pam page on GNOME Wiki has some more information.

Ubuntu and Debian will configure PAM automatically, and they put the module to /etc/pam.d/common-auth and /etc/pam.d/common-session, which are included by gdm/login and most other PAM configs. You can use this command to check all configurations at once:

grep -r gnome_keyring /etc/pam.d

Make Linux support NTFS File Type

CEntOS - 5 and RHEL-5/6 is not supporting mounting of NTFS partition, fix harddisk, removable usb harddisk with NTFS partition, some packages need to be installed on it to make NTFS mountable.

1) First confirm you kernel version

[root@demo ~]# rpm -qa | grep kernel
kernel-2.6.X.el6.x86_64

2) Search the package NTFS-3G at http://rpm.pbone.net/. Select the packages which match with your kernel, my system using ntfs-3g-2011.4.12-3.el6.src.rpm

3) Install it :

[root@demo src]# rpm -ivh ntfs-3g-2011.4.12-3.el6.x86_64.rpm

4) Done & Reboot

2011/07/06

Yum From DVD

RHEL6/Oracle Linux 一般必需注册(免费30 天评估或付费)才可以获得线上软体更新支援及下载, 不注册的话其实亦可以使用光碟来执行yum 安装, 此方法适合多台电脑进行评估测试时免去大量注册所需, 及没有联网环境的独立电脑, 而且多台电脑亦可以共用光碟分享位置(无需大量烧录光碟)来安装软体, 当然如果要更新软体的话就必需付费注册(除非手动自行编译更新源码套件)。

小弟安装的是Oracle Linux 6.1

1) 插入光盘(废话吗?),你的光盘应该会auto mount, 路径是 : /media/OL6.1xxx

2) 安装createrepo

[root@oracle]# cd /media/OL6.1/Packages
[root@oracle]# rpm –ivh createrepo -XX.rpm
#过程中缺少的Dependency一一给它安装,在同一个目录就可以找到它们了

3) 新建一个目录(任何地方)

[root@oracle]# mkdir /media/repolocal

4) 建立repodata数据文件

[root@oracle]# cd /media/repolocal
[root@repolocal]# createrepo -vpo /media/repolocal/ /media/OL6.1
[root@repolocal]# ln -s /media/OL6.1/HighAvailability/ ./HighAvailability

5) 建立一个新的.repo文件

[root@repolocal]#  vim /etc/yum.repos.d/DVD.repo
#Insect Following content:

[dvd]
name=OL6.1 DVD
baseurl=file:///media/repolocal
enabled=1
gpgcheck=0

6)用update来验证

[root@oracle]# yum update

如果没有任何错误信息,恭喜恭喜

Automatic Login In Linux And Gnome

There are a lot of people out there that want to have their Linux box automatically login for them after a reboot. As always there is more than one way to do this. You first have to decide what method you prefer to use. You can setup a user to automatically login and you can also setup a user to login using a timed login. I will show you how to do both.


AUTOMATICALLY LOGIN:

In order to setup your Linux box to automatically login using a particular user, you will need to follow the steps below.

For most newer versions of Red Hat (Red Hat 5/6), Fedora Core (Fedora Core 13/14), Ubuntu (10.04/10.10) you need to edit /etc/gdm/custom.conf using terminal and add the following to the [daemon]:

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=username   ###NOTE:  Where username is your username you use to login to the linux box. ###

TIMED LOGIN:

In order to setup your Linux box to login using a particular user and a timed login, you will need to follow the steps below.
For most newer versions of Red Hat (Red Hat 5/6), Fedora Core (Fedora Core 13/14), Ubuntu (10.04/10.10) you need to edit /etc/gdm/custom.conf using terminal and add the following to the [daemon]:

[daemon]
TimedLoginEnable=true
TimedLogin=username   ###NOTE:  Where username is your username you use to login to the linux box. ###

The methods above currently work for most newer versions of Linux and Gnome. However, occasionally you will run into some older versions of Linux and Gnome. If the methods above do not work for your particular Linux distro and Gnome, you can try the steps below:
In order to setup your Linux box to login using a particular user and a timed login, you will need to follow the steps below.

You need to edit /usr/share/gdm/defaults.conf using terminal and add the following to the [daemon]:

[daemon]
TimedLoginEnable=true
TimedLogin=username   ###NOTE:  Where username is your username you use to login to the linux box. ###

If you are using Novell’s Suse 10 or Suse 11, you will need to do the following to get automatic logins working:

From a terminal, run the following command:

su -c ‘/bin/bash /sbin/yast2 users’

This will open up the “User and Group Administration” Window. From there, click the drop down menu on the “Expert” middle button. Then select “Login Settings”, this will bring up the “Display Manager Login Settings” Window. Now, you can select “Auto Login” and click the drop down to select the user you want to login automatically.

That’s it. You should now be able to have your linux users login automatically.

Wikimedia配置

其个Wiki Site, 方便大家,所以,先来学习如何配置wikimedia。

一,安装这个不用写什么了,配置apache,可以正常访问页面,启动mysql数据库。
然后把下载的mediawiki-1.9.3cn.zip解压到/var/www/html/目录下,更名为wiki(方便)。
进入wiki目录执行:

#chmod a+w config  

在浏览器里输入 http://ip/wiki/index.php,开始安装。
主要是填写信息,如果出错的话,会显示红色提示信息。如果正确安装也会有提示成功。
安装成功后,把config下的LocalSettings.php移动到父母里。然后执行


#chmod a-w config

二,常用配置
1.开放图片上传功能:

#chmod a+w wiki/images
#vi wiki/LocalSettings.php,
把$wgEnableUploads = false; 改为 $wgEnableUploads = true;

2.更改网站左上角的logo
把自己的135x135象素的png图片放到wiki/skins/common/images 下,并命名为wiki.png

3.常用的提示信息更改
特殊页面->系统界面

4.左侧工具条的定制
到系统界面
在搜寻栏中输入: sidebar, 然后编辑:

* navigation
** mainpage|mainpage
** portal-url|portal
** currentevents-url|currentevents
** recentchanges-url|recentchanges
** randompage-url|randompage
** helppage|help
** sitesupport-url|sitesupport

第一行(一个前导*)表示导航栏的名称,其提示文本在“mediawiki:navigation”页面中修改,也可以直接输入文字信息(文字不能与内部mediawiki参数页面重名)。

後续行(两个前导*)表示实际导航栏的内容,其格式为“链接网址|显示文本”。其中,链接网址有三种类型:

    * 直接输入http网址,例如直接输入“http://www.allwiki.com/bbs”
    * 文章页面标题,例如输入“天下维客”代表站内文章“[[天下维客]]”的网址
    * mediawiki名字空间的参数页,例如输入“mainpage”代表文字信息参数页面“[[mediawiki:mainpage]]”的网址。此类 字串还有helppage、portal-url等,请到special:allmessages里面查看更多的此类字串。

显示文本的设定与导航栏名称设定类似,可以:

    * 直接输入文字信息
    * 使用mediawiki名字空间参数页的标题缩写,例如上文默认文本中的“randompage”、“sitesupoort”分别代表“[[mediawiki:randompage]]”和“[[mediawiki:sitesupport]]”。

用户可根据需求删除/增加mediawiki:sidebar页面中的项目,修改後左侧导航栏就会发生相应改变。(本方法适用于mediawiki默认的monobook皮肤风格)
举例示范如下:

* 导航文字
** 文章标题|文章标题项
** http://www.allwiki.com/bbs|直接网址项

5.Mediawiki增加友情链接侧栏
想在mediawiki工具栏下方添加友情链接,请打开skins/Monobook.php,找到如下两行:

<?php if( $this->data['language_urls'] ) { ?><div id="p-lang" class="portlet">
   <h5><?php $this->msg('otherlanguages') ?></h5>

在前面添加:

<div class="portlet" id="p-tb">
   <h5>友情链接</h5>
   <div class="pBody">
     <ul>
     <li id="feedlinks""><a href="http://www.allwiki.com" target="_blank"><img src="http://www.allwiki.com/images/allwiki_logo.gif" border="0" alt="天下维客" /></a></li>
     <li id="
feedlinks""><a href="http://zh.wikipedia.org" target="_blank"><img
src="http://upload.wikimedia.org/wikipedia/zh/c/ce/Wiki_button.png" border="0" alt="中文维基百科" /></a></li>
     </ul>
     </div>
 </div>

请根据需要,修改上面内容中的链接、图片网址和alt字串(文字提示)。
    * 注意:①上述内容必须使用UTF-8格式进行存盘,否则汉字显示乱码;②本修改只针对默认的monobook风格。

6.关于网站提速
很多人感到MediaWiki的运行速度非常之慢,其实这里面有很多原因是页面样式的问题。请到“参数设置→皮肤”中选择“科隆香水蓝44”,体会迅捷如飞的感觉!


7.时间显示设置
在LocalSetting.php的倒数第三行加入:

$wgLocaltimezone = "Asia/Shanghai"; putenv("TZ=$wgLocaltimezone"); $wgLocalTZoffset = date("Z") / 60;


8.阻止新用户注册
更改LocalSetting.php,添加:

$wgGroupPermissions['*' ]['createaccount'] = false;

注 意:阻止新用户注册,此时管理员可以到特殊页面上的用户登录页面(Special:UserLogin)里,输入希望为其建立帐户的某人的用户名与电子邮 件地址,然后点击通过eMail(by email)按钮递交,系统将创建帐号并将随机生成的密码发送到指定email里。

9.禁止匿名用户编辑
在LocalSetting.php里添加:

$wgGroupPermissions['*' ]['createaccount'] = false;
$wgGroupPermissions['*' ]['read'] = true;
$wgGroupPermissions['*' ]['edit'] = false;

10.设置匿名用户可读内容

$wgWhitelistRead = array( "Main Page", "Special:Userlogin" );
$wgGroupPermissions['*' ]['read'] = false;

注意:具体需要对应自己的站点链接,而对于多字节语言的MediaWiki,例如中文首页链接index.php?title=%E9%A6%96%E9%A1%B5,这首页中文字符PHP可能无法正确解码。需要利用urldecode()函数转换一下,写为:

$wgWhitelistRead = array( urldecode("%E9%A6%96%E9%A1%B5") ;

11.对没有登录的用户移除页面顶部的讨论页链接
在LocalSetting.php里添加:

$wgShowIPinHeader = false;

12.在数据库中手工改变用户组
用 户权限包含在user_groups表中,该表有两个字段,分别是ug_user和ug_group。对用户所属的每一个组,都必须有一行插入。您必须从 用户表(users)中获知用户的ID。以下的SQL查询语句将能完成此功能。在下例中将 1 替换为从users表中得到的ID号.

INSERT INTO user_groups (ug_user, ug_group) VALUES ('1', 'bureaucrat'); INSERT INTO user_groups (ug_user, ug_group) VALUES ('1', 'sysop');

13.其它登陆用户不能编辑,只有DB2组的用户可以编辑
在LocalSetting.php里添加

$wgGroupPermission['DB2']['read'] = true;
$wgGroupPermissions['DB2']['edit']= true;
$wgGroupPermissions['user']['edit']=false;