这是我在教程中看到的一个命令:
mkswap /swap && chown root. /swap && chmod 0600 /swap && swapon /swap
Run Code Online (Sandbox Code Playgroud)
这是什么.意思?
在.在这种情况下是一个弃用形式:,并且是新的所有者和组之间的隔板。
来自info chown:
Run Code Online (Sandbox Code Playgroud)Some older scripts may still use ‘.’ in place of the ‘:’ separator. POSIX 1003.1-2001 (*note Standards conformance::) does not require support for that, but for backward compatibility GNU ‘chown’ supports ‘.’ so long as no ambiguity results. New scripts should avoid the use of ‘.’ because it is not portable, and because it has undesirable results if the entire OWNER‘.’GROUP happens to identify a user whose name contains ‘.’.
所以在这种情况下,它与 相同chown root: /swap,这反过来意味着
OWNER:
If a colon but no group name follows OWNER, that user is made the
owner of the files and the group of the files is changed to OWNER’s
login group.
Run Code Online (Sandbox Code Playgroud)
由于 root 的登录组是root,它相当于chown root:root /swap
它是一个缩短的版本
sudo chown root:root /swap
Run Code Online (Sandbox Code Playgroud)
因为它将组设置为与用户名相同。
尝试创建一个文件夹,然后以同样的方式将所有权设置为 root,然后在完成后,尝试将所有权设置为您的用户名。
sudo chown $USER. folder/
Run Code Online (Sandbox Code Playgroud)
希望这有帮助!
| 归档时间: |
|
| 查看次数: |
589 次 |
| 最近记录: |