chmod -rwx prac1
abayomi@AbayomiUsman:~/.ssh$ ll | grep prac1
-r-xr-xr-x 1 abayomi abayomi 2655 Feb 18 15:55 prac1*
-rwxrwxrwx 1 abayomi abayomi 574 Feb 18 15:55 prac1.pub*
abayomi@AbayomiUsman:~/.ssh$ chmod a-rwx prac1
abayomi@AbayomiUsman:~/.ssh$ ll | grep prac1
-r-xr-xr-x 1 abayomi abayomi 2655 Feb 18 15:55 prac1*
-rwxrwxrwx 1 abayomi abayomi 574 Feb 18 15:55 prac1.pub*
abayomi@AbayomiUsman:~/.ssh$ chmod -rwx prac1
abayomi@AbayomiUsman:~/.ssh$ chmod -rwx prac1
abayomi@AbayomiUsman:~/.ssh$ sudo chmod -rwx prac1
[sudo] password for abayomi:
abayomi@AbayomiUsman:~/.ssh$ ll | grep prac1
-r-xr-xr-x 1 abayomi abayomi 2655 Feb 18 15:55 prac1*
-rwxrwxrwx 1 abayomi abayomi 574 Feb 18 15:55 prac1.pub*
abayomi@AbayomiUsman:~/.ssh$
findmnt -T 的结果。
findmnt -T .
TARGET SOURCE FSTYPE OPTIONS
/mnt/c C:\ drvfs rw,noatime,uid=1000,gid=1000,case=off
我进一步做了更多的事情,比如
ssh -i prac1 [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for 'prac1' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "prac1": bad permissions
[email protected]: Permission denied (publickey).
abayomi@AbayomiUsman:~/.ssh$ ll | grep prac1
-rwxrwxrwx 1 abayomi abayomi 2655 Feb 18 15:55 prac1*
-rwxrwxrwx 1 abayomi abayomi 574 Feb 18 15:55 prac1.pub*
abayomi@AbayomiUsman:~/.ssh$ chmod -rwx prac1
chmod: prac1: new permissions are ----w--w-, not ---------
abayomi@AbayomiUsman:~/.ssh$ chmod a-rwx prac1
abayomi@AbayomiUsman:~/.ssh$ ll | grep prac1
-r-xr-xr-x 1 abayomi abayomi 2655 Feb 18 15:55 prac1*
-rwxrwxrwx 1 abayomi abayomi 574 Feb 18 15:55 prac1.pub*
abayomi@AbayomiUsman:~/.ssh$
但它仍然不会完全删除权限,我不知道为什么请帮忙
这是尝试参考文章中提供的解决方案后的结果
chmod -rwx prac1
chmod: prac1: new permissions are ----w--w-, not ---------
abayomi@AbayomiUsman:~/.ssh$ chmod a-rwx prac1
abayomi@AbayomiUsman:~/.ssh$ ll | grep prac1
-r-xr-xr-x 1 abayomi abayomi 2655 Feb 18 15:55 prac1*
-rwxrwxrwx 1 abayomi abayomi 574 Feb 18 15:55 prac1.pub*
它仍然不会删除所有权限
答案1
FSTYPE 是 drvfs,因此它看起来像是 Windows 上的 WSL。
尝试更改挂载选项以包含 fmask=111 来删除 eXecute 位。
查看此处的“安装选项”:
https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/
答案2
直接设置您想要的权限即可完成。
zeus@zeus-H370M:~/test$ ls -l
total 257548
-rw-r--r-- 1 zeus zeus 31758 May 4 2020 1588603424397.JPEG
-rw-r--r-- 1 zeus zeus 274601 Mar 15 2020 Screen_Shot.png
-rw-r--r-- 1 zeus zeus 263407719 Feb 2 00:36 Test.mkv
-rw-r--r-- 1 zeus zeus 4 Feb 18 11:19 untitled.txt
zeus@zeus-H370M:~/test$ chmod 0600 *
zeus@zeus-H370M:~/test$ ls -l
total 257548
-rw------- 1 zeus zeus 31758 May 4 2020 1588603424397.JPEG
-rw------- 1 zeus zeus 274601 Mar 15 2020 Screen_Shot.png
-rw------- 1 zeus zeus 263407719 Feb 2 00:36 Test.mkv
-rw------- 1 zeus zeus 4 Feb 18 11:19 untitled.txt