我有一个名为的文件myfile
,我想使用以下命令进行移动:
sudo mv myfile deep-dark-directory/
我需要使用sudo
来移动文件,因为deep-dark-directory
需要 root 权限才能写入,并且我无法更改的权限deep-dark-directory
。
我如何更改权限/所有权myfile
以便根用户可以移动它?
尝试 1:
$ chown root myfile
chown: changing ownership of `myfile': Operation not permitted
尝试2:
$ sudo chown root myfile
chown: changing ownership of `myfile': Operation not permitted
尝试3:
$ chmod a+x myfile
$ ls -l index.html.1
-rwxrwxrwx 1 hh360 hh360 10819 May 15 12:08 myfile
$ sudo mv myfile deep-dark-directory/
mv: cannot remove `myfile': Permission denied
尝试4:
$ sudo chmod a+x myfile
chmod: changing permissions of `myfile': Operation not permitted
操作系统:Ubuntu 12.04 64位
答案1
您可能需要在当前工作目录中具有写权限:
chmod u+w .