[SOLVED] SFPT - Vsftpd on Ubuntu: Disallow client timestamp on uploaded files.
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
SFPT - Vsftpd on Ubuntu: Disallow client timestamp on uploaded files.
Hi,
I'm running vsftpd on a Ubuntu server. I'd need vsftpd to disallow the timestamp on files it receives from clients. Right now the behaviour is that the uploaded files get the timestamp from the files itself using WINSCP with Preserve Timestamp option enabled. I'd like to make config on server side witch disalowed clients such as WINSCP to preserve timestamps.
I done some research and try different options with mdtm_write=NO in conf file but nothing works.
I'm running vsftpd on a Ubuntu server. I'd need vsftpd to disallow the timestamp on files it receives from clients. Right now the behaviour is that the uploaded files get the timestamp from the files itself using WINSCP with Preserve Timestamp option enabled. I'd like to make config on server side witch disalowed clients such as WINSCP to preserve timestamps.
I done some research and try different options with mdtm_write=NO in conf file but nothing works.
vsftpd: version 3.0.3
Thanks !
Are you sure your clients are using FTP? The default with WinSCP is to use SFTP, which uses sshd on the server side, not vsftpd.
You're right, this is SFTP connection via port 22. To be precise this is a VM on Azure with linux ubuntu witch I configured with this tutorial (except that I deny access for port 21 in NSG):
If you are using SFTP, then you can (and should) remove vsftpd from your server.
As for the date-time stamps, can you describe your task in a little more detail or in different words? If you are copying a file to your server using SFTP, it gets the time-date of its arrival on the server, not its original time-date. If you wish to preserve the the original time-date, then use the -p option with the SFTP client, or with the get or put command within SFTP.
However, if you are not using the regular SFTP client but WinSCP instead, look to the documentation for WinSCP instead. Or else try a different client.
If you are using SFTP, then you can (and should) remove vsftpd from your server.
As for the date-time stamps, can you describe your task in a little more detail or in different words? If you are copying a file to your server using SFTP, it gets the time-date of its arrival on the server, not its original time-date. If you wish to preserve the the original time-date, then use the -p option with the SFTP client, or with the get or put command within SFTP.
However, if you are not using the regular SFTP client but WinSCP instead, look to the documentation for WinSCP instead. Or else try a different client.
In my task I share SFTP with multiple users. They can use several SFTP clients, I really don't know which one. Now, when I use SFTP, my file gets timestamp from the server and that's correct. But if any of my clients use winSCP with preserve timestamp option on (it's on by default) - the file save orginal timestamp. And that's not correct. I try to configure my server to dissalow that option. I need timestamp from server all the time.
There are side effects. That will also block the built-in chmod and related tools.
See "man sftp-server" for the -Q and -P options.
Works untill I reboot :
When I upload files via WinSCP I get exeption and timestamp from server on my file. Works great
Then I reboot my machine and preserve timestamp in WinSCP works again.
Step-by-Step:
1. Create VM with Ubuntu Server 18.04 LTS
2. SSH -> Add --> Subsystem sftp /usr/lib/openssh/sftp-server -P setstat,fsetstat in sshd_config
3. Test ok - exception. Cant preserve timestamp
4. Disallow SSH on user (sudo usermod -s /usr/lib/openssh/sftp-server and add /usr/lib/openssh/sftp-serve in /etc/shells)
5. sudo chmod 0700 /home/user
6. test ok - exception.
7. Reboot
8. Test fail - Can preserve timestamp.
Ok. Figure it out. After I use that - 'sudo usermod -s /usr/lib/openssh/sftp-server user' sshd_config wont work for that user. How Can I restrict access to SSH for users and make them affected by my sshd_config in the same time?
Last edited by Cichowczyc; 03-04-2020 at 05:13 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.