日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

文件或目录权限chmod,更改所有者和所属组chown ,umask的使用 ,隐藏权限的使用 lsattr,chattr...

發布時間:2025/3/20 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 文件或目录权限chmod,更改所有者和所属组chown ,umask的使用 ,隐藏权限的使用 lsattr,chattr... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文件或目錄權限chmod,更改所有者和所屬組chown ,umask的使用 ,隱藏權限的使用 lsattr,chattr

r = 可讀w =可寫 x=可執行 ? ??

[root@alex ~]# ls -l

total 20

drwxr-xr-x. 2 root root 4096 Oct 25 08:49 1.txt

drwxr-xr-x. 2 root root 4096 Oct 16 14:01 c

drwx所有者的權限? ? ? ?r-x 所屬組的權限 ? ? ? ? r-x除去所有者所屬組的權限 ??

r=4 ?w=2 ?x=1 ? ? ?rwx=7 ? r-x=5 ?r-x=5 ? ? ?文件755

[root@alex ~]# chmod 700 1.txt ? ? ? ? ? ? ? ? chmod的使用方法?? ?

total 20

drwx------. 2 root root 4096 Oct 25 08:49 1.txt

chmod -R 777 ? dataitu ? ? chomd只對文件或者目錄本身生效,加上選項-R 就會在目錄的本身或者子目錄子文件一起生效

文件當中的.文件 ? 是沒有關閉selinux ?

getenforce

setenforce ?0 ? ? ? 關閉 ?

[root@alex ~]# getenforce

Permissive ??

[root@alex ~]# vi /etc/selinux/config ? ? 更改配置權限 ?的命令?

chmod ? 其他寫法 ? u=用戶 ? g=組 ? ?o=其他用戶 ? ?

[root@alex ~]# chmod u=rwx,g=r--,o=r--??1.txt ? ? 寫法 ?

[root@alex ~]# ls -l

total 20

drwxr--r--. 2 root root 4096 Oct 25 08:49 1.txt

?

[root@alex ~]# chmod u-x??1.txt ? ? ?也可以這么寫 ? ? ? ? u-x ? ?g-x ? a-x ? ? ??

[root@alex ~]# ls -l

total 20

drw-r--r--. 2 root root 4096 Oct 25 08:49 1.txt ??

chown ? 可以更改所有者 ?和所屬組 ?

[root@alex ~]# chown dabaitu /tmp/alex ? ? ? ?更改權限的寫法 ??

[root@alex ~]# chown root:dabaitu /tmp/alex ? ? ? ?同時更改的寫法 ??

[root@alex ~]# ls -l /tmp/ ? ? ? ? ? ? ? ? ? ? ? ? ??

total 16

drwxr-xr-x. 2 root root????4096 Oct 25 08:54 2.txt

srwxr-xr-x. 1 root root???????0 Oct 21 10:47 Aegis-<Guid(5A2C30A2-A87D-490A-9281-6765EDAD7CBA)>

drwxr-xr-x. 3 root dabaitu 4096 Oct 24 09:25 alex

[root@alex ~]# chown :user /tmp/alex ? ? 只更改組 的寫法 ?

[root@alex ~]# ls -l /tmp

total 16

drwxr-xr-x. 2 root root 4096 Oct 25 08:54 2.txt

srwxr-xr-x. 1 root root????0 Oct 21 10:47 Aegis-<Guid(5A2C30A2-A87D-490A-9281-6765EDAD7CBA)>

drwxr-xr-x. 3 root user 4096 Oct 24 09:25 alex

[root@alex ~]# chown -R root:user /tmp/alex ? ? ?也可以這樣加上R選項 ? 同時更改文件的子文件子目錄 ? ??

[root@alex ~]# ls -l /tmp/alex

total 4

drwxr-xr-x. 2 root user 4096 Oct 24 09:42 1

umask ??

目錄必須要有x權限 ? ?,沒有x權限我們都不能瀏覽目錄 ,更何況操作呢 ?

umask ?是決定默認和目錄文件的權限 ? ?

[root@alex ~]# umask

0022

必須用rwxrwxrwx ?去減 才能得出權限 ??

[root@alex ~]# umask 003 ? ?修改umak ? ??

[root@alex ~]# umask

0003

[root@alex ~]# umask 022

[root@alex ~]# umask

0022

chattr ? lsattr ? ?隱藏權限 ??

[root@alex ~]# chattr +i 1.txt ??

加上i權限不可以寫,不可以更改名字 ? 不可以刪除 ? 也無法創建 ??

[root@alex ~]# chattr -i 1.txt ? ?接觸的用法 ?

查看是 ?

lsattr ? 1.txt

[root@alex ~]# chattr +a 2.txt ? ? ?只能追加 ?不能刪除 ?,不能更改 ,不能重命名 ?

[root@alex ~]# lsattr 2.txt ? ? 查看a權限 ?

-----a-------e-- 2.txt

[root@alex ~]# chattr -a???2.txt ? ? ? -a可以把權限去掉 ??

[root@alex ~]# lsattr 2.txt

-------------e-- 2.txt

[root@alex ~]# lsattr -d???m ? ? 減d查看目錄本身 ? ? ?給目錄添加的時候 只可以追加重定向?

-------------e-- m

[root@alex ~]# chattr +i m ? ? ?用法 ?

[root@alex ~]# lsattr -d m

----i--------e-- m

lsattr ?-R 可以查看文件的下面的子文件子目錄 ?全部列出來 ?

lsattr -a ?全部包括影藏的 ??

[root@alex ~]# lsattr -a /root/

-------------e-- /root/.cache

-------------e-- /root/.pydistutils.cfg

-------------e-- /root/.tcshrc

-------------e-- /root/zx

-------------e-- /root/2.txt

-------------e-- /root/.bash_logout

-------------e-- /root/.cshrc

-------------e-- /root/m

-------------e-- /root/.bash_history

-------------e-- /root/p

-------------e-- /root/.ssh

-------------e-- /root/.

-------------e-- /root/c

-------------e-- /root/.pip

-------------e-- /root/.bashrc

-------------e-- /root/..

-------------e-- /root/3.txt

-------------e-- /root/.bash_profile



本文轉自 amenging 51CTO博客,原文鏈接:http://blog.51cto.com/11335852/1976285

總結

以上是生活随笔為你收集整理的文件或目录权限chmod,更改所有者和所属组chown ,umask的使用 ,隐藏权限的使用 lsattr,chattr...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。