I have two computers, both running Ubuntu (Ubuntu Server 10.04LTS on one, Ubuntu Desktop 10.10 on the other). I setup a Samba share on the Desktop. On the Server, I mounted the Samba share to /mnt/fileserver. This is the share:

    path = /home/fileserver/files
    guest ok = yes
    writeable = yes
    create mask = 0777
    directory mask = 0777

I have a script on the Server to backup my local web development files and put them on the Desktop. They are bzipped and then put into the Samba mount. When I try to move them into the Samba mount with the mv command, I get

mv: failed to preserve ownership for 'file': Permission denied

This is what my script looks like:

_DIR=$(date +%m-%d-%Y)

mkdir /mnt/fileserver/webserver_backups/$_DIR

tar vfcpj /tmp/www.tar.bz2 /var/www 2>> /var/log/backup.txt

mv /tmp/www.tar.bz2 /mnt/fileserver/webserver_backups/$_DIR/www.tar.bz2

All the files still seem to make it over okay, but I'm curious why I get this error.

2 Answers 2


Disregard the error.

Linux and Windows set file permissions in a radically different manner. The files get transferred just fine, but since the permission styles are incompatible, the permissions you originally had on the files don't transfer. Eg, what user owned the file, was it executable, could everyone read it or not..

Transferred files thus inherit the samba share's mount settings. If you mounted using Susan's credentials, she now owns the file.

  • Is it possible to avoid seeing this error? I have a folder with thousands of files and makes the console "dirty".
    – xarlymg89
    Jun 13, 2018 at 8:42
  • @CarlosAlbertoMartínezGadea you could redirect errors to the great bit-bucket in the sky, but maybe you would miss something different: mycommand 2>/dev/null. you may want to grep stderr
    – djeikyb
    Jun 15, 2018 at 2:01
  • I opted to perform a cp of the folder, and it removes the error message. Then I just remove the original folder. However, thank you for answering, it seems reasonable to not ignore the errors, otherwise, as you pointed out, we can miss something important.
    – xarlymg89
    Jun 18, 2018 at 8:23
  • 1
    @CarlosAlbertoMartínezGadea copying is a great alternative! for bulk stuff i like rsync with the progress meter
    – djeikyb
    Jun 19, 2018 at 5:17

I had this same error, but the file moved anyway. After the error check the source and destination to see if the file move was a success. I spent ages looking for a solution to the error not realizing I didn't have to resolve anything.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .