UNIX File Permission

The default file permissions (umask):

Each user has a default set of permissions which apply to all files created by that user, unless the software explicitly sets something else. This is often called the 'umask', after the command used to change it. It is either inherited from the login process, or set in the .cshrc or .login file which configures an individual account, or it can be run manually.

Typically the default configuration is equivalent to typing 'umask 22' which produces permissions of:

-rw-r--r-- for regular files, or
drwxr-xr-x for directories.

In other words, user has full access, everyone else (group and other) has read access to files, lookup access to directories.

When working with group-access files and directories, it is common to use 'umask 2' which produces permissions of:

-rw-rw-r-- for regular files, or
drwxrwxr-x for directories.

For private work, use 'umask 77' which produces permissions:

-rw------- for regular files, or
drwx------ for directories.

The logic behind the number given to umask is not intuitive.

The command to change the permission flags is "chmod". Only the owner of a file can change its permissions.

The command to change the group of a file is "chgrp". Only the owner of a file can change its group, and can only change it to a group of which he is a member.

 

WARNINGS:

Putting 'umask 2' into a startup file (.login or .cshrc) will make these settings apply to everything you do unless manually changed. This can lead to giving group access to files such as saved email in your home directory, which is generally not desireable.

 

Making a file group read/write without checking what its group is can lead to accidentally giving access to almost everyone on the system. Normally all users are members of some default group such as "users", as well as being members of specific project-oriented groups. Don't give group access to "users" when you intended some other group.

 

Remember that to read a file, you need execute access to the directory it is in AND read access to the file itself. To write a file, your need execute access to the directory AND write access to the file. To create new files or delete files, you need write access to the directory. You also need execute access to all parent directories back to the root. Group access will break if a parent directory is made completely private.

读文件 需要: 文件的读权限 + 文件目录的执行权限(包括所有父目录的执行权限)

写文件 需要: 文件的写权限 + 文件目录的执行权限(包括所有父目录的执行权限)

新建/删除文件 需要: 文件目录的写权限(包括所有父目录的执行权限)

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
出现 "No such file or directory" 错误是因为指定的镜像文件路径不正确。请确保你提供的 `<镜像文件路径>` 是正确的,并且文件存在于该路径下。你可以使用 `ls` 命令确认文件是否存在。 至于 "permission denied" 错误,它表示你没有足够的权限来连接 Docker 守护进程。 要解决这个问题,你可以尝试以下几种方法: 1. 确保你使用的用户具有执行 Docker 命令的权限。将用户添加到 `docker` 用户组中,然后重新登录系统即可。例如,在 Ubuntu 中,你可以运行以下命令将当前用户添加到 `docker` 组中: ``` sudo usermod -aG docker $USER ``` 注意:在某些操作系统中,可能需要使用 `su - $USER` 或重新启动系统才能使更改生效。 2. 如果你是使用 `sudo` 命令来执行 Docker 命令的,请确保你在 `sudo` 命令前面指定了完整的命令路径,例如: ``` sudo /usr/bin/docker load -i <镜像文件路径> ``` 这将确保 `sudo` 命令正确地运行 Docker 命令。 3. 确保 Docker 守护进程正在运行。你可以使用以下命令检查 Docker 进程的状态: ``` sudo systemctl status docker ``` 如果 Docker 守护进程未运行,请使用适当的命令启动它,例如: ``` sudo systemctl start docker ``` 在某些系统上,你可能需要使用 `sudo service docker start` 或其他类似的命令。 如果以上方法都不起作用,可能是因为你没有足够的权限来执行 Docker 相关操作。请与管理员联系以获取进一步支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sjmz30071360

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值