Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 898
  • Last Modified:

How to disable deleting file after uploading in sftp

I have configured sftp on my system but want to disable users to not to delete it after uploading.

here is the configuration.

sshd_config

Match Group abcd
 X11Forwarding no
 AllowTcpForwarding no
 ChrootDirectory /data/inftp/abcd
 ForceCommand internal-sftp
0
apunkabollywood
Asked:
apunkabollywood
  • 3
  • 2
  • 2
1 Solution
 
MazdajaiCommented:
One way is to put sticky bit on the target directory. It would be difficult for home directory because user should have full access.

chown -Rv root:user /path
chmod 1775 /path

Open in new window

0
 
gheistCommented:
What is being deleted?
0
 
apunkabollywoodAuthor Commented:
Hi All,

I am sorry , I agree applying sticky bit , But still after applying that user can delete the newly uploaded file.

Is there something we can restrict commands in sftp?
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
MazdajaiCommented:
If you can post the permission of the directories (ls -lah) perhaps we can determine what is wrong.

You can disable commands in ftp but I cannot think of a way to prevent users running commands via sftp session since it is a extension of the ssh protocol.
0
 
apunkabollywoodAuthor Commented:
Thanks Mazdajai !

Now I configured FTPS :) , so that can apply command restrictions.

All working fine , But now I am facing upload error.

Response:      553 Could not create file.
Error:      Critical file transfer error

SElinux disabled, Please let me know if you need more details.
0
 
gheistCommented:
Sftp is something else. Is ftps working?
0
 
apunkabollywoodAuthor Commented:
Thanks all for ur help its working with ftps configured
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now