标签:file 输入 cannot 编程 pts chattr stp blog null
原始文件:
find /etc -name passwd 2>&1 | tee ee.log
1. cat -n 把 e.log 的文档内容加上行号后输入 e2.log 这个文档里:
xiluhua@localhost ~/t2scripts $ cat -n e.log | tee e2.log 1 /etc/passwd 2 3 4 find: `/etc/ntp/crypto‘: Permission denied 5 find: `/etc/audisp‘: Permission denied 6 find: `/etc/audit‘: Permission denied 7 8 find: `/etc/polkit-1/localauthority‘: Permission denied 9 find: `/etc/dhcp‘: Permission denied 10 /etc/pam.d/passwd 11 find: `/etc/lvm/backup‘: Permission denied 12 find: `/etc/lvm/cache‘: Permission denied 13 find: `/etc/lvm/archive‘: Permission denied 14 find: `/etc/cups/ssl‘: Permission denied 15 find: `/etc/pki/rsyslog‘: Permission denied 16 17 18 19 20 21 22 find: `/etc/pki/CA/private‘: Permission denied 23 find: `/etc/vmware-tools/GuestProxyData/trusted‘: Permission denied 24 find: `/etc/sudoers.d‘: Permission denied 25 find: `/etc/selinux/targeted/modules/active‘: Permission denied
2. cat -b 把 textfile1 和 textfile2 的文档内容加上行号(空白行不加)之后将内容附加到 textfile3 文档里:
xiluhua@localhost ~/t2scripts $ cat -b e.log | tee e3.log 1 /etc/passwd 2 find: `/etc/ntp/crypto‘: Permission denied 3 find: `/etc/audisp‘: Permission denied 4 find: `/etc/audit‘: Permission denied 5 find: `/etc/polkit-1/localauthority‘: Permission denied 6 find: `/etc/dhcp‘: Permission denied 7 /etc/pam.d/passwd 8 find: `/etc/lvm/backup‘: Permission denied 9 find: `/etc/lvm/cache‘: Permission denied 10 find: `/etc/lvm/archive‘: Permission denied 11 find: `/etc/cups/ssl‘: Permission denied 12 find: `/etc/pki/rsyslog‘: Permission denied 13 find: `/etc/pki/CA/private‘: Permission denied 14 find: `/etc/vmware-tools/GuestProxyData/trusted‘: Permission denied 15 find: `/etc/sudoers.d‘: Permission denied 16 find: `/etc/selinux/targeted/modules/active‘: Permission denied
3. cat /dev/null 清空 ee.log 文档内容:
cat /dev/null > e3.log
4. chattr +i:不得任意更动文件或目录。
root@localhost /home/xiluhua/t2scripts $ chattr +i ttt.sh $ 加了 +i 之后,root权限也删不了了 root@localhost /home/xiluhua/t2scripts $ rm -rf ttt.sh rm: cannot remove `ttt.sh‘: Operation not permitted
5. chgrp (1)
root@localhost /home/xiluhua/t2scripts # touch ttt.sh root@localhost /home/xiluhua/t2scripts # ll ttt.sh -rw-r--r--. 1 root root 0 Jan 15 15:22 ttt.sh root@localhost /home/xiluhua/t2scripts # chgrp xiluhua ttt.sh root@localhost /home/xiluhua/t2scripts # ll ttt.sh -rw-r--r--. 1 root xiluhua 0 Jan 15 15:22 ttt.sh
6. chgrp (2)
标签:file 输入 cannot 编程 pts chattr stp blog null
原文地址:http://www.cnblogs.com/xiluhua/p/6287256.html