我对使用命令行还很陌生。我最近安装了 Ubuntu,并且一直在尝试一些简单的命令。我发现有些目录中我无法创建新文件或编辑现有文件。这似乎只发生在目录下的目录中user
,例如Desktop
,Documents
...
例如这个工作正常:
iboopedu@CODE1026:/mnt/c/Users/shane$ touch test.txt
然而这些却没有:
iboopedu@CODE1026:/mnt/c/Users/shane/Desktop$ touch test.txt
touch: cannot touch 'test.txt': No such file or directory
iboopedu@CODE1026:/mnt/c/Users/shane/Documents$ touch test.txt
touch: cannot touch 'test.txt': No such file or directory
尝试编辑并保存这些目录中现有文件的更改会产生以下结果:
[ Error writing test_edit.txt: Permission denied ]
故障排除
我尝试了以下操作,但没有成功:
- 权限似乎不是问题
iboopedu@CODE1026:/mnt/c/Users/shane/Desktop$ stat /mnt/c/Users/shane/Desktop
File: /mnt/c/Users/shane/Desktop
Size: 512 Blocks: 0 IO Block: 512 directory
Device: ch/12d Inode: 54606145481977805 Links: 1
Access: (0777/drwxrwxrwx) Uid: ( 1000/iboopedu) Gid: ( 1000/iboopedu)
Access: 2019-04-25 11:55:52.524860400 +1000
Modify: 2019-04-25 11:40:54.971595700 +1000
Change: 2019-04-25 11:40:54.971595700 +1000
- 以管理员身份运行(以管理员身份运行 Ubuntu 以及以管理员身份执行命令)
iboopedu@CODE1026:/mnt/c/Users/shane/Desktop$ sudo touch test.txt
[sudo] password for iboopedu:
touch: cannot touch 'test.txt': No such file or directory
- 我从 Slack 社区获得了一些建议,并尝试了以下方法
iboopedu@CODE1026:/mnt/c/Users/shane/Desktop$ touch ./test.txt
touch: cannot touch './test.txt': No such file or directory
iboopedu@CODE1026:/mnt/c/Users/shane/Desktop$ touch /mnt/c/Users/shane/Desktop/test.txt
touch: cannot touch '/mnt/c/Users/shane/Desktop/test.txt': No such file or directory
iboopedu@CODE1026:/mnt/c/Users/shane/Desktop$ test -d ./ && echo "Directory exists"
Directory exists
iboopedu@CODE1026:/mnt/c/Users/shane/Desktop$ test -d /mnt/c/Users/shane/Desktop && echo "Directory exists"
Directory exists
iboopedu@CODE1026:/mnt/c/Users/shane/Desktop$ > test.txt
-bash: test.txt: No such file or directory
这就是我们现在的情况!希望有人能帮忙
。TIA