Home > Mobile >  Linux mv command failed
Linux mv command failed

Time:12-01

I've been moving some directories, and got a permission denied where I would not have expected.

I'm not changing any permissions, it's just me on the machine, it's all the same filesystem, same owner and group throughout, not aware of any running process on this machine that could interfere. The only thing I can think of is that the "plugins" directory is a soft link on the same partition, but not sure how that would be an issue.

user@host:/directory/app/plugins$ mv SomeSuperPlugin ../plugins.notworking/
mv: cannot move 'SomeSuperPlugin' to '../plugins.notworking/': Permission denied

As far as I'm concerned, that should have worked.

user@host:/directory/app/plugins$ cd ..
user@host:/directory/app$ ls -lht
total 4K
drwxr-xr-x  2 user    user    4.0K Nov 30 11:48 plugins.notworking
lrwxrwxrwx  1 root    root      24 Oct 27 09:24 plugins -> /directory2/plugins
user@host:/directory/app$ mv plugins/SomeSuperPlugin plugins.notworking
user@host:/directory/app$ ls plugins.notworking/ -lht
total 4K
drwxr-xr-x  7 user    user    4.0K Oct 20 16:28 SomeSuperPlugin

CodePudding user response:

When you're in /directory/app/plugins (a soft link to /directory2/plugins), you're referenced to /directory2/plugins. You'll not see ../plugins.notworking/ from there.

If you run ls .., you'll see /directory2/ instead of /directory/app.

One option, try this: (cd -L .. && mv plugins/SomeSuperPlugin plugins.notworking/) from /directory/app/plugins

  •  Tags:  
  • bash
  • Related