root@localhost:~# setcap cap_net_raw+p /bin/ping
root@localhost:~# getcap /bin/ping
root@localhost:~# ls -l $(which ping)
-rwsr-xr-x. 1 root root 34752 Nov 8 2014 /bin/ping
root@localhost:~# ping localhost
ping: icmp open socket: Operation not permitted
root@localhost:~#
看起来由于某种原因我的setcap
设置没有得到反映,知道我哪里出错了吗?
按 @meuh 要求的详细信息
root@localhost:~# for i in /proc/fs/*/*/options ;do echo ${i}=&&cat ${i}|grep user_xattr;done
/proc/fs/ext4/mmcblk0p16/options=
user_xattr
/proc/fs/ext4/mmcblk0p25/options=
user_xattr
/proc/fs/ext4/mmcblk0p27/options=
user_xattr
/proc/fs/ext4/mmcblk0p28/options=
user_xattr
root@localhost:~# mount|grep ext4
/dev/block/platform/msm_sdcc.1/by-name/system on /system type ext4 (ro,seclabel,relatime)
/dev/block/platform/msm_sdcc.1/by-name/userdata on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,nomblk_io_submit,noauto_da_alloc,errors=panic,data=ordered)
/dev/block/platform/msm_sdcc.1/by-name/cache on /cache type ext4 (rw,seclabel,nosuid,nodev,noatime,nomblk_io_submit,noauto_da_alloc,errors=panic,data=ordered)
/dev/block/platform/msm_sdcc.1/by-name/persist on /persist type ext4 (rw,seclabel,nosuid,nodev,relatime,nomblk_io_submit,nodelalloc,errors=panic,data=ordered)
root@localhost:~# df -h --output
Filesystem Type Inodes IUsed IFree IUse% Size Used Avail Use% File Mounted on
/dev/block/platform/msm_sdcc.1/by-name/userdata ext4 820K 35K 785K 5% 13G 1.4G 12G 12% - /data
tmpfs tmpfs 181K 486 181K 1% 928M 80K 928M 1% - /dev
none tmpfs 181K 6 181K 1% 928M 12K 928M 1% - /sys/fs/cgroup
tmpfs tmpfs 181K 22 181K 1% 928M 0 928M 0% - /mnt
root@localhost:~# df --output -h /bin/ping
Filesystem Type Inodes IUsed IFree IUse% Size Used Avail Use% File Mounted on
rootfs rootfs 820K 35K 785K 5% 13G 1.4G 12G 12% /bin/ping /