0

I'm essentially trying to disable the mv command for FTP users on my CentOS server.

I was thinking of editing their .bash_profile file and using this:

alias mv=""

But that feels system breaking. Feels like there may be an actual, secure and better way to disable mv for FTP users.

All I want to allow for FTP users is PUT, GET and DELETE.

How do I restrict mv for FTP users properly?

  • What ftp server software are you using? – Jeff Schaller Feb 14 '19 at 15:55
  • @JeffSchaller er not sure actually - it's just out-the-box CentOS – treyBake Feb 14 '19 at 15:55
  • Are the users the only ones using the FTP server? Have you tried adding cmds_allowed=STOR,RETR,DELE to your etc/vsftpd.conf? – d10nte Feb 17 '19 at 7:31
0

Non-ftp way

Using file-system permissions.

You could make it so that directories and file are not in the same directories. Then you can remove write permission of the parent directories.

Explanation

In Unix, a file can not be added, removed, or renamed, if it is in a directory where the user does not have write permission. Therefore to prevent a file/directory from being moved, put it in a directory where there are no write permissions. Note the owner of the directory, can change the permissions.

You may need to re-arrange the directory structure, to do this.

Use the sticky-bit.

You can not remove a file (directory or anything else) from a directory with the sticky-bit set, unless you are the owner. This will also stop users removing/renaming files, unless they own them.

  • I feel a little lost with that haha sorry, could you explain a little further please? :) – treyBake Feb 14 '19 at 16:45
  • ah I'm with ya! Ok ... only problem is, it's a Magento 1 website, so I don't have any flexibility in changing dir structure without possibly killing Magento 1 – treyBake Feb 18 '19 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.