Users can upload/delete/rename files via vsftp server and everything works well except they can also move files across directories.

Is it possible to allow renaming of files but disallow moving them around?


/ftp/work/xls/list.xls # can be deleted/renamed but should not moved to ie. 'doc'
/ftp/work/doc/list.doc # same thing, should not be moved elsewhere

4 Answers 4


you can try playing with :

  • cmds_allowed

    This options specifies a comma separated list of allowed FTP commands (post login. USER, PASS and QUIT and others are always allowed pre-login). Other commands are rejected. This is a powerful method of really locking down an FTP server. Example: cmds_allowed=PASV,RETR,QUIT Default: (none)

  • cmds_denied

    This options specifies a comma separated list of denied FTP commands (post login. USER, PASS, QUIT and others are always allowed pre-login). If a command appears on both this and cmds_allowed then the denial takes precedence. (Added in v2.1.0).

and block the RNTO command for example.

  • this is interesting, but RNTO is also used when renaming plain files, not just when moving them around
    – mpapec
    Oct 29, 2013 at 6:17

I would say that the unix model is to allow wrote to the directories you want, u.e. /home/mpapec and to disallow access un specific directories as desired.


If you have a readlink that supports the -e switch for path canonicalization, I suggest you prevent your users from using mv altogether and write your own mv as a replacement. Something like this perhaps:


[ $# -ne 2 ] && echo "Only a two-argument mv is allowed" && exit 1


srcdir="$(readlink -e "$(dirname "$src")")"
dstdir="$(readlink -e "$(dirname "$dst")")"

[ "$srcdir" != "$dstdir ] && echo "Cross-directory mv is forbidden" && exit 2
[ "$(basename "$src")" = "$(basename "$dst")" ] && echo "Source and destination are the same. Nothing to do." && exit 3

cp -p "$src" "$dst" && rm -f "$src"

Note that this will (obviously) cause the moved file's inode number to change unlike a regular mv.

  • is there a way to force vsftp to run external script before renaming?
    – mpapec
    Oct 29, 2013 at 6:19
  • @mpapec I wouldn't know. What I'm suggesting is to actually revoke execute rights to the original mv executable for vsftp users and force them to use this script instead (place it in their PATH somewhere before the original mv). Or better yet, jail vsftp users and make the original mv unavailable inside the jail.
    – Joseph R.
    Oct 30, 2013 at 11:43

Are you sure the directories which you want to move files to is enable to +rw competence?

Have a try:

  1. root mode

  2. mount -o remount,rw dir (dir is the directories which you want to move files to)

  • Actually, I believe the problem is the other way around: the users can move the files to these other directories and the OP wants to revoke that permission.
    – Joseph R.
    Oct 27, 2013 at 9:34
  • @JosephR. that is correct
    – mpapec
    Oct 27, 2013 at 9:43

You must log in to answer this question.

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