Score:0

sftp - "protocol error: mtime.sec not present" when using /usr/sbin/nologin

mx flag

I am trying to use sftp to pull a file from a remote server.

Both client and server-side users are created with adduser --system and their shell is /usr/sbin/nologin. The users are called legit-backup.

Public-key authorisation has been configured for the client user to have SSH access to the server as a user of the same name. When I try to pull down the file /home/legit-backup/test a file using the command sudo -u legit-backup scp legit-backup@<remote-server>:~/test, I receive the error protocol error: mtime.sec not present, no files copy down.

If I change the remote user's shell to /bin/bash then sftp works as normal.

I wan to use /usr/sbin/nologin for security reasons, the user should not be able to have SSH access other than sftp, is it possible?

hr flag
You might consider using `ForceCommand internal-sftp` instead of setting the nologin shell. See for example [Is it possible to grant users sftp access without shell access? If yes, how is it implemented?](https://unix.stackexchange.com/a/503346/65304)
Helper avatar
tf flag
Use sftp command instead, it should work
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.