This happens to me often. It's one of two things:
# Notice the missing ':' after host?
scp -r foo/ user@host
# in this case, with or without the ':', the `cp` is what's wrong.
cp -r foo/ user@host
cp -r foo/ user@host:
Usually, it's the first example that I mistype. I forgot the :
, which scp treats as more or less a literal cp command.
For the second part of the mystery -- Since you also mentioned the folder is write protected, likely you included a sudo
in front of one of these commands at one point. Again, I've done the same thing many times.
References:
- See the discussion at this q/a for more background.
cp
instead ofscp
and it created the folder. Check your history by runninghistory | grep <ip address>
and see if maybe it was an accident.ls -al
on that folder you should see the permissions and who is the owner of it.