File Permisions
来源:互联网 发布:linux查看用户权限 编辑:程序博客网 时间:2024/05/21 22:54
The command chown is the chmod's cousin. It is used for changing the ownership rights of a file (hence the name 'chown' - change owner). It does not change the read, write and execution permissions however.
This command, though available to every user, is probably going to be used when you're working as root. The command is uses like this:
Code:
Let's say you want to copy something from your Windows partition (if you have one). You mount the partition (as root) and to save time, you copy the file to your user directory /home/bob/. If you type ls -l the_file you'll get something like this:
Code:
As we now know from the previous lesson, root is the owner of the file. Therefore, root is the only one who has write permissions for the file (permission to modify its content). If you plan on working with the file as "bob", there isn't a snowball's chance in hell to modify that file until, as root, you run chown on the file. So let's do it!
Code:
This example presupposes that your Linux version creates groups for each user. There are others that will create a generic group called users for everybody who uses the computer. On a network, groups are created according to the needs of the organization. On your single home computer, just type ls -l and see what system corresponds to you.
As you can see, 'chown' is absolutely necessary if you're working as more than one user with the computer.
This command, though available to every user, is probably going to be used when you're working as root. The command is uses like this:
Code:
chown owner.group filename
Let's say you want to copy something from your Windows partition (if you have one). You mount the partition (as root) and to save time, you copy the file to your user directory /home/bob/. If you type ls -l the_file you'll get something like this:
Code:
-rw-r--r-- 1 root root 2428 Nov 17 13:18 the_file
As we now know from the previous lesson, root is the owner of the file. Therefore, root is the only one who has write permissions for the file (permission to modify its content). If you plan on working with the file as "bob", there isn't a snowball's chance in hell to modify that file until, as root, you run chown on the file. So let's do it!
Code:
chown bob.bob the_file
This example presupposes that your Linux version creates groups for each user. There are others that will create a generic group called users for everybody who uses the computer. On a network, groups are created according to the needs of the organization. On your single home computer, just type ls -l and see what system corresponds to you.
As you can see, 'chown' is absolutely necessary if you're working as more than one user with the computer.
阅读全文
0 0
- File Permisions
- Beginners Level Course:File Permisions - chown
- File
- file
- File
- file
- File
- File
- file
- file
- file
- File
- File
- file
- file
- File
- FILE
- file
- WebView的一些坑
- oracle导入dmp文件
- Anaconda安装PyTorch
- (商用版)对对机如何打印自动饿了么外卖订单小票教程
- The Selfish Giant
- File Permisions
- 四大组件之服务、AIDL
- dropout防止过拟合
- 欢迎使用CSDN-markdown编辑器
- 使用Collections.sort(List<T>,Comparator<? super T>)给List<String>排序
- Content-Disposition 响应头,设置文件在浏览器打开还是下载
- Median of Two Sorted Arrays
- 访问https 绕过证书验证方法
- 写给后端程序员的HTTP缓存原理介绍