Press "Enter" to skip to content

Month: January 2016

Windows10无法访问Samba服务器的方法

Windows10无法访问Samba服务器的方法。这里有以下两种情况。

1,Windows10(作为客户端)无法访问其它服务器上共享出来的目录

1,打开注册表编辑器(运行regedit并回车);
2,展开HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters,右击Parameters,选择“新建”-“DWORD (32位)值”,名称为AllowInsecureGuestAuth,并且将该值设置为1,保持默认的16进制不变。
参考文档

2,Windows10(作为服务端)的共享目录,在其它服务器上无法访问

1,打开控制面板\网络和 Internet\网络和共享中心\高级共享设置;
2,找到“所有网络”下面的“密码保护的共享”,选择“关闭密码保护共享”。
参考文档

4 Comments

Gnome3修改字体

获得系统已安装的字体列表

$ fc-list
$ fc-list :lang=zh
$ fc-list :lang=zh |  cut -d : -f 2 | cut -d, -f1 | sort | uniq -c

修改Gnome Shell字体

$ sudo vim /usr/share/gnome-shell/theme/gnome-shell.css  #修改如下内容

……
font-family: cantarell, sans-serif;
……

经过以上修改,重启后就会发现Gnome Shell字体变了。但是,(欢迎)登陆界面,字体仍未被修改,原因未知

修改系统字体

$ sudo apt-get install gnome-tweak-tool   #适用ubuntu/debian

$ yum install gnome-tweak-tool      #适用fedora

然后在应用程序列表里找到“优化工具”即可设置。

Leave a Comment

Linux系统下查看网卡列表

Linux系统下如果没有安装udev的话,网卡不会以eth0的方式存在于系统里,系统会直接使用BIOS传递过来的设备名作为网卡名称,例如em1之类的。那么如何查看所有网卡的名称呢?

$ cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
 bond0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
   em2:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
   em4:    3587      18    0    0    0     0          0         2    11100      65    0    0    0     0       0          0
  p3p1:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
    lo:    3934      64    0    0    0     0          0         0     3934      64    0    0    0     0       0          0
   em1:   15196     117    0   18    0     0          0        19    15865     107    0    0    0     0       0          0
  p3p2:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
   em3:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
 
$ netstat -i
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500 0         0      0      0 0             0      0      0      0 BMmU
em1        1500 0       193      0     33 0           144      0      0      0 BMRU
em2        1500 0         0      0      0 0             0      0      0      0 BMU
em3        1500 0         0      0      0 0             0      0      0      0 BMU
em4        1500 0        18      0      0 0            69      0      0      0 BMRU
lo        65536 0       119      0      0 0           119      0      0      0 LRU
p3p1       1500 0         0      0      0 0             0      0      0      0 BMsU
p3p2       1500 0         0      0      0 0             0      0      0      0 BMsU
Leave a Comment

解决XFS文件系统NFS输出Stale NFS file handle错误

公司有一台SAN存储,其中划出了26TB的容量通过open-iscsi输出到某台Ubuntu Server上,然后再在这台Ubuntu Server配置好NFS,将26TB共享至其它Clients上。一直使用的好好的,在某一天,客户端在挂载时,突然就出现了Stale NFS file handle的错误。经过无数次谷歌以后,找到了解决方案。这里记录一下。

一开始,以为是分区出现逻辑错误,准备尝试fsck一下(XFS文件系统不能使用fsck命令),于是有了以下过程

$ sudo xfs_check /dev/vg-15k/users
ERROR: The filesystem has valuable metadata changes in a log which needs to
be replayed.  Mount the filesystem to replay the log, and unmount it before
re-running xfs_check.  If you are unable to mount the filesystem, then use
the xfs_repair -L option to destroy the log and attempt a repair.
Note that destroying the log may cause corruption -- please attempt a mount
of the filesystem before doing this.



$ sudo xfs_repair /dev/vg-15k/users
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
ERROR: The filesystem has valuable metadata changes in a log which needs to
be replayed.  Mount the filesystem to replay the log, and unmount it before
re-running xfs_repair.  If you are unable to mount the filesystem, then use
the -L option to destroy the log and attempt a repair.
Note that destroying the log may cause corruption -- please attempt a mount
of the filesystem before doing this.



$ sudo xfs_repair -L /dev/vg-15k/users
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
ALERT: The filesystem has valuable metadata changes in a log which is being
destroyed because the -L option was used.
        - scan filesystem freespace and inode maps...
sb_icount 64, counted 4884352
sb_ifree 61, counted 15726
sb_fdblocks 2683832778, counted 1409694604
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - agno = 4
        - agno = 5
        - agno = 6
        - agno = 7
        - agno = 8
        - agno = 9
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - check for inodes claiming duplicate blocks...
        - agno = 0
        - agno = 1
        - agno = 3
        - agno = 2
        - agno = 4
        - agno = 5
        - agno = 6
        - agno = 7
        - agno = 9
        - agno = 8
Phase 5 - rebuild AG headers and trees...
        - reset superblock...
Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - traversal finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done
Leave a Comment

Ubuntu重启网络服务

Ubuntu重启网络服务的命令总是那么另类。。

sudo stop network-manager
sudo service network-manager stop
sudo service network-interface restart INTERFACE=ethX
Leave a Comment

LDAP的相关概念与objectClass介绍

一,部分LDAP专用名词的解释

Objectclass
LDAP对象类,是LDAP内置的数据模型。每种objectClass有自己的数据结构,比如我们有一种叫“电话薄”的objectClass,肯定会内置很多属性(attributes),如姓名(uid),身份证号(uidNumber),单位名称(gid),家庭地址(homeDirectory)等,同时,还有一种叫“同学录”的objectClass,具备“电话薄”里的一些attributes(如uid、homeDirectory),还会具有“电话薄”没有的attributes(如description等)

Entry
entry可以被称为条目,一个entry就是一条记录,是LDAP中一个基本的存储单元;也可以被看作是一个DN和一组属性的集合。注意,一条entry可以包含多个objectClass,例如zhang3可以存在于“电话薄”中,也可以同时存在于“同学录”中

DN
Distinguished Name,LDAP中entry的唯一辨别名,一条完整的DN写法:uid=zhang3,ou=People,dc=163,dc=com。LDAP中的entry只有DN是由LDAP Server来保证唯一的。

LDAP Search filter
使用filter对LDAP进行搜索。 Filter一般由 (attribute=value) 这样的单元组成,比如:(&(uid=ZHANGSAN)(objectclass=person)) 表示搜索用户中,uid为ZHANGSAN的LDAP Entry.再比如:(&(|(uid= ZHANGSAN)(uid=LISI))(objectclass=person)),表示搜索uid为ZHANGSAN, 或者LISI的用户;也可以使用*来表示任意一个值,比如(uid=ZHANG*SAN),搜索uid值以 ZHANG开头SAN结尾的Entry。更进一步,根据不同的LDAP属性匹配规则,可以有如下的Filter: (&(createtimestamp>=20050301000000)(createtimestamp<=20050302000000)),表示搜索创建时间在20050301000000和20050302000000之间的entry。

6 Comments

Ubuntu14.04配置LDAP Client

Ubuntu 14.04系统上配置LDAP客户端的过程,记录一下。

sudo apt-get install ldap-utils ldap-auth-client libnss-ldap libpam-ldap

安装过程中提示填写ldap相关信息:ldap server地址,base dc等,信息保存在/etc/ldap.conf中,可通过dpkg-reconfigure ldap-auth-config重新配置,其中:

lda地址格式 ldap://192.168.x.x:389
Distinguished name of the search base: 就是你目录树的根,比如我的是dc=163,dc=com
LDAP version to use: 3
Make local root Database admin: Yes
Does the LDAP database require login? No
LDAP account for root:  安装LDAP服务器时的创建的admin账号,我的是cn=admin,dc=163,dc=com
LDAP root account password: 

修改/etc/nsswitch.conf文件,添加ldap登陆方式,同时系统查找顺序,以便在查询 LDAP服务器之前先检查您的本地passwd文件

sudo cp -p /etc/nsswitch.conf /etc/nsswitch.conf.bak
sudo auth-client-config -t nss -p lac_ldap
Leave a Comment