码迷,mamicode.com
首页 > 系统相关 > 详细

linux-第七课时笔记-[权限]

时间:2017-08-25 18:47:45      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:执行   目录   test   用法   修改权限   默认   bsp   笔记   roo   

权限管理

 

Linux权限:

         r : 读

w : 写

         x : 执行

 

         -rw-r--r--  1 root root

         -        文件(d            代表目录)

         3位一组

         前3位是代表属主的权限 rwx

         中间3位代表属组的权限 rwx

         后3位代表其他用户的权限 rwx

 

         r 4              w 2            x 1

 

 

         新建文件的默认权限

                            0664----   -rw-rw-r--.

                   最高权限是0666

         新建目录的默认权限

                            0755----    drwx-r-xr-x.

                   最高权限是0777

 

修改权限:chmod

 

         用法:chmod 文件/目录

                   Chmod 664 1.txt

 

                   [root@CrushLinux ~]# ll 1.txt

-rw-r--r-- 1 root root 0 Aug 25 14:01 1.txt

[root@CrushLinux ~]# chmod 664 1.txt

[root@CrushLinux ~]# ll 1.txt

-rw-rw-r-- 1 root root 0 Aug 25 14:01 1.txt

 

 

Chmod u+r 1.txt   (- w/x)      属主       可加可减

Chmod g+r 1.txt     (- w/x)  属组           可加可减

Chmod o+r 1.txt       (- w/x)       其他         可加可减

 

修改属主属组:chown

        

         用法:chown [属主:属组] 1.txt

         例如:

[root@CrushLinux ~]# ll 1.txt

-rw-rw-r-- 1 root root 0 Aug 25 14:01 1.txt

[root@CrushLinux ~]# useradd test

[root@CrushLinux ~]# chown test:test 1.txt

[root@CrushLinux ~]# ll 1.txt

-rw-rw-r-- 1 test test 0 Aug 25 14:01 1.txt

[root@CrushLinux ~]# chown root 1.txt

[root@CrushLinux ~]# ll 1.txt

-rw-rw-r-- 1 root test 0 Aug 25 14:01 1.txt

[root@CrushLinux ~]# chown :root 1.txt

[root@CrushLinux ~]# ll 1.txt

-rw-rw-r-- 1 root root 0 Aug 25 14:01 1.txt

linux-第七课时笔记-[权限]

标签:执行   目录   test   用法   修改权限   默认   bsp   笔记   roo   

原文地址:http://www.cnblogs.com/msl23/p/7429261.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!