安装 Wireshark 的时候,有一步是给 dumpcap 读网卡的权限,使得普通用户也可以使用 Wireshark 进行抓包。
# setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/sbin/dumpcap
那么 setcap 是个啥玩意呢?
feichashao's Blog
安装 Wireshark 的时候,有一步是给 dumpcap 读网卡的权限,使得普通用户也可以使用 Wireshark 进行抓包。
# setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/sbin/dumpcap
那么 setcap 是个啥玩意呢?
1. 检查CPU是否支持硬件辅助虚拟化
~~~
egrep '^flags.*(vmx|svm)' /proc/cpuinfo
~~~
2. 安装所需的包
~~~
# yum install qemu-kvm qemu-img virt-manager libvirt libvirt-python python-virtinst libvirt-client
~~~
3. 检查BIOS是否禁用了虚拟化支持,如果是,修改BIOS设置。
~~~
[root@dhcp-192-114 ~]# dmesg | grep kvm
[ 10.737953] kvm: disabled by bios
[ 10.756640] kvm: disabled by bios
[ 1078.359177] kvm: disabled by bios
[ 1081.517789] kvm: disabled by bios
~~~
4. 检查内核模块
~~~
[root@dhcp-192-114 ~]# lsmod | grep kvm
kvm_intel 138567 3
kvm 441119 1 kvm_intel
~~~
1. 尝试在vim中输入命令
~~~
:set encoding=utf-8
set fileencoding=utf-8
~~~
如果之后能正常显示中文/日文,说明是编码的问题。
2. 编辑~/.vimrc文件,加上如下几行:
~~~
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
~~~
问题即可修复。
Issue:
[root@host1 Code-Intro]# ./cpu A & ; ./cpu B & ; ./cpu C & ; ./cpu D &
-bash: syntax error near unexpected token `;'
Resolution:
You don't need to add ";" between background tasks, just enter the command as follow:
[root@host1 Code-Intro]# ./cpu A & ./cpu B & ./cpu C & ./cpu D &
[1] 2284
[2] 2285
[3] 2286
[4] 2287
1. 安装所需软件
[root@s1 ~]# yum install samba -y [root@s1 ~]# yum install samba-client -y [root@s1 ~]# yum install policycoreutils-python
2. 创建共享目录
[root@s1 ~]# mkdir /sharedpath [root@s1 ~]# semanage fcontext -a -t samba_share_t '/sharedpath(/.*)?' [root@s1 ~]# restorecon -vvFR /sharedpath/ restorecon reset /sharedpath context unconfined_u:object_r:default_t:s0->system_u:object_r:samba_share_t:s0
1. Facebook and Twitter are special treated in China.
2. I use IPv4/IPv6 tunnel to access Internet, so disabling IPv6 globally is not desirable.
3. I need to use school's DNS server, but that DNS return wrong answer of facebook/twitter.
继续阅读“How to force firefox accessing Facebook/Twitter via IPv4”
[root@host1 Code-Intro]# gcc -o cpu cpu.c -Wall
/tmp/ccG1P1Rf.o: In function `Pthread_create':
cpu.c:(.text+0xce): undefined reference to `pthread_create'
/tmp/ccG1P1Rf.o: In function `Pthread_join':
cpu.c:(.text+0x11a): undefined reference to `pthread_join'
collect2: ld returned 1 exit status
[root@host1 Code-Intro]# gcc -o cpu cpu.c -Wall -lpthread
(add "-lpthread" option.)