sftp does not allow rename across file system

Ted Smith ted_smith1 at verizon.net
Fri Jan 18 11:38:59 EST 2013

I got the error
EXDEV (Invalid cross-device link)
when renaming one file to another directory that is actually mounting 
another file system.

I am using SSH-2.0-OpenSSH_6

with standard SFTP setup as below

Subsystem       sftp    internal-sftp

Match group sftponly
         ChrootDirectory /home/sftp/%u
         X11Forwarding no
         AllowTcpForwarding no
         ForceCommand internal-sftp

there are two subdirs in a user home
subPlain  (a plain unix dir)
subMounted  (a dir that is actually mounting a different file system, or 
using mount --bind <targetDir> subMounted  )

when using sftp rename

rename subPlaib/F1 subPlaib/F2
works fine.

rename subPlaib/F1 subMounted/F2


strace output shows the error as

read(0, "\0\0\0H\310\0\0\0&\0\0\0\30posix-rename at openss"..., 16384) = 76
rename("/johnson/ttt", "/johnson/shared/kkk") = -1 EXDEV (Invalid 
cross-device link)
select(2, [0], [1], NULL, NULL)         = 1 (out [1])
write(1, "\0\0\0\30e\0\0\0&\0\0\0\4\0\0\0\7Failure\0\0\0\0", 28) = 28

I have tried with different sftp clients without success.

Any help would be appreciated.



More information about the openssh-unix-dev mailing list